Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#164109890 add redirect to social controller #45

Merged

Conversation

Proception
Copy link
Contributor

What does this PR do?

This adds a redirect to the social authentication process to the frontend

Description of Task to be completed?

  • add redirect url
  • remove test for redirect

How should this be manually tested?

  • run npm run start:dev
  • run http://localhost:9000/api/v1/auth/{provider}/callback

Any background context you want to provide?

N/A

What are the relevant pivotal tracker stories?

#164109890

Screenshots (if appropriate)

N/A

import models from '../db/models';
import TokenAuthenticate from '../helpers/TokenAuthenticate';
import Response from '../helpers/response';

dotenv.config();

const { FRONTEND_BASE_PATH } = process.env

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

@@ -1,9 +1,14 @@
/* eslint-disable no-underscore-dangle */
/* eslint-disable camelcase */
import dotenv from 'dotenv'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

if (newUser) {
response = new Response(
'Ok',
201,
'User logged in successfully',
{ token }
);
return res.status(response.code).json(response);
return res.redirect(`${FRONTEND_BASE_PATH}/auth?token=${token}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you redirecting from the server? I'll go ahead and merge this in the meantime though

@andela-dbamidele
Copy link

I also don't know why you removed some test @Proception. Please find time to fix the test coverage

@andela-dbamidele andela-dbamidele merged commit 109c745 into staging Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants