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

#159987698 Social media auth integration #26

Merged
merged 8 commits into from
Sep 5, 2018

Conversation

d-beloved
Copy link
Contributor

@d-beloved d-beloved commented Sep 5, 2018

What does this PR do?

Add social media authentication login in the app

Description of Task to be completed?

added two new endpoints to the routes GET /api/auth/facebook GET /api/auth/facebook

User can signup on the app with their existing Google and facebook account

How should this be manually tested?

*  After cloning the app
*  create a .env file from .envsample
*  create an app on Google developer and Facebook developer panel and put the ID and secret in the 
    .env file created
*  run npm install
*  Install and setup Postgres
*  run npm start:dev to start the development server  
*  make a GET request to /api/auth/facebook to authenticate a user with Facebook account
*  make a GET request to /api/auth/google to authenticate a user with google account

What are the relevant pivotal tracker stories?

159987698

- user sign up and login through their existing facebook, twitter and google account

159987698
- ensure user is authenticated using facebook
- ensure the user is authenticated using google
- ensure the user is authenticated using twitter

159987698
- ensure a user can signup or login to the app using their existing
facebook, google account
- Store the received parameters in the dtatabase
- user signup and login by facebook account is available
- user signup and login using google account is available
- fix the coveralls error

[Delivers #159987698]
- user can login with either their existing facebook and google accounts
- fix the coverage errors in the repo

[Delivers #159987698]
= change a few files to fix travis build error

[Fixes #159987698]

router.post('/auth/response', SocialAuthController.response);

export default router;

Choose a reason for hiding this comment

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

'export' is only available in ES6 (use 'esversion: 6').

import { Router } from 'express';
import SocialAuthController from '../../controllers/socialAuth';

const router = Router();

Choose a reason for hiding this comment

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

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,23 @@
import passport from 'passport';
import { Router } from 'express';
import SocialAuthController from '../../controllers/socialAuth';

Choose a reason for hiding this comment

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

'import' is only available in ES6 (use 'esversion: 6').

@@ -0,0 +1,23 @@
import passport from 'passport';
import { Router } from 'express';

Choose a reason for hiding this comment

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

'import' is only available in ES6 (use 'esversion: 6').

@@ -0,0 +1,23 @@
import passport from 'passport';

Choose a reason for hiding this comment

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

'import' is only available in ES6 (use 'esversion: 6').

firstName: req.user.firstName,
image: req.user.image
};
const { email } = user;

Choose a reason for hiding this comment

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

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'destructuring binding' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

* @memberof SocialAuthController
*/
static response(req, res) {
const user = {

Choose a reason for hiding this comment

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

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

id, email, username, firstName, lastName, image
} = foundOrCreated.dataValues;
done(null, {
email, id, username, firstName, lastName, image, created,

Choose a reason for hiding this comment

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

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

},
defaults: user,
}).spread((foundOrCreated, created) => {
const {

Choose a reason for hiding this comment

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

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'destructuring binding' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

email: user.email
},
defaults: user,
}).spread((foundOrCreated, created) => {

Choose a reason for hiding this comment

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

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

@aknwosu aknwosu merged commit f2e545a into develop Sep 5, 2018
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