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

#166841012 Integrate social Login #17

Closed
wants to merge 27 commits into from

Conversation

Alpha1202
Copy link
Contributor

What does this PR do?

Integrate Social Login for google, facebook and twitter

Description of Task to be completed?

  • install passport
  • install passport-facebook
  • install passport-google-oauth20
  • install passport-twitter
  • initialise passport strategies

Have the following endpoints working

GET /api/auth/google
GET /api/auth/facebook
GET /api/auth/twitter

How should this be manually tested?

After cloning the repo, cd into the folder and RUN npm run start:dev

  • on your choice browser, go to any of the routes above

Any background context you want to provide?

  • N/A

What are the relevant pivotal tracker stories?

Screenshots (if appropriate)

  • N/A

Questions:

  • N/A

install passport
install passport-facebook
install passport-google-oauth20
install passport-twitter
initialise passport strategies
[#166841012]
});
}
}
}
Copy link

Choose a reason for hiding this comment

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

Newline required at end of file but not found eol-last

static async socialUser(req, res) {
try {
const userData = req.authInfo;
console.log(userData);
Copy link

Choose a reason for hiding this comment

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

Unexpected console statement no-console


export {
googleStrategy, facebookStrategy, twitterStrategy, SerializeSetUp
};
Copy link

Choose a reason for hiding this comment

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

Unexpected line break before this closing brace object-curly-newline

});
};

export {
Copy link

Choose a reason for hiding this comment

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

Unexpected line break after this opening brace object-curly-newline

.reply(200, 'Facebook connection established');

describe('passport strategy', () => {
it('should be a function', (done) => {
Copy link

Choose a reason for hiding this comment

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

'done' is defined but never used no-unused-vars


const accessToken = 'vubhjnklmewrtyu';
const refreshToken = 'jhvbknhjnkmknkl';
const profile = {
Copy link

Choose a reason for hiding this comment

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

'profile' is assigned a value but never used no-unused-vars

import app from '../src/server';

const accessToken = 'vubhjnklmewrtyu';
const refreshToken = 'jhvbknhjnkmknkl';
Copy link

Choose a reason for hiding this comment

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

'refreshToken' is assigned a value but never used no-unused-vars

import { socialCallBack } from '../src/helpers/helpers';
import app from '../src/server';

const accessToken = 'vubhjnklmewrtyu';
Copy link

Choose a reason for hiding this comment

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

'accessToken' is assigned a value but never used no-unused-vars

passport.use(new MockStrategy('google', socialCallBack, randomSocialUser));
passport.use(
new MockStrategy('facebook', socialCallBack, randomSocialUser)
);
Copy link

Choose a reason for hiding this comment

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

Unexpected newline before ')' function-paren-newline

}

passport.use(new MockStrategy('google', socialCallBack, randomSocialUser));
passport.use(
Copy link

Choose a reason for hiding this comment

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

Unexpected newline after '(' function-paren-newline

import config from './db/config/config';
import {
googleStrategy, facebookStrategy, twitterStrategy, SerializeSetUp
} from './config/social_config';
Copy link

Choose a reason for hiding this comment

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

Unexpected line break before this closing brace object-curly-newline

import config from './db/config/config';
import {
Copy link

Choose a reason for hiding this comment

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

Unexpected line break after this opening brace object-curly-newline

install passport
install passport-facebook
install passport-google-oauth20
install passport-twitter
initialise passport strategies
[#166841012]
@czarjulius czarjulius had a problem deploying to ah-nyati-backend-staging-pr-17 July 4, 2019 12:45 Failure
Nzubechukwu Nnamani added 2 commits July 4, 2019 19:51
install passport
install passport-facebook
install passport-google-oauth20
install passport-twitter
initialise passport strategies
[#166841012]
@czarjulius czarjulius had a problem deploying to ah-nyati-backend-pr-17 July 4, 2019 18:52 Failure

if (displayName) {
firstname = displayName.split(' ')[0];
lastname = displayName.split(' ')[0];
Copy link

Choose a reason for hiding this comment

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

Use array destructuring prefer-destructuring

const { displayName } = userData;

if (displayName) {
firstname = displayName.split(' ')[0];
Copy link

Choose a reason for hiding this comment

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

Use array destructuring prefer-destructuring

@czarjulius czarjulius had a problem deploying to ah-nyati-backend-pr-17 July 4, 2019 18:54 Failure
@czarjulius czarjulius had a problem deploying to ah-nyati-backend-pr-17 July 4, 2019 18:57 Failure
Copy link
Contributor

@codeBlock-1984 codeBlock-1984 left a comment

Choose a reason for hiding this comment

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

Great job @Alpha1202. Looks good to go

Copy link
Contributor

@czarjulius czarjulius left a comment

Choose a reason for hiding this comment

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

Looks good to me

@@ -0,0 +1,68 @@
import chai, { expect } from 'chai';
Copy link

Choose a reason for hiding this comment

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

Definition for rule 'jsx-a11y/anchor-is-valid' was not found jsx-a11y/anchor-is-valid

test/mockUser.js Outdated
@@ -0,0 +1,16 @@
import faker from 'faker';
Copy link

Choose a reason for hiding this comment

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

Definition for rule 'jsx-a11y/anchor-is-valid' was not found jsx-a11y/anchor-is-valid

import config from './db/config/config';
import {
googleStrategy, facebookStrategy, twitterStrategy, gitHubStrategy, SerializeSetUp
} from './config/social_config';
Copy link

Choose a reason for hiding this comment

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

Unexpected line break before this closing brace object-curly-newline

import config from './db/config/config';
import {
Copy link

Choose a reason for hiding this comment

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

Unexpected line break after this opening brace object-curly-newline

@@ -0,0 +1,24 @@
import { Router } from 'express';
Copy link

Choose a reason for hiding this comment

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

Definition for rule 'jsx-a11y/anchor-is-valid' was not found jsx-a11y/anchor-is-valid

@@ -0,0 +1,22 @@
import jwt from 'jsonwebtoken';
Copy link

Choose a reason for hiding this comment

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

Definition for rule 'jsx-a11y/anchor-is-valid' was not found jsx-a11y/anchor-is-valid

@@ -0,0 +1,84 @@
import { User } from '../db/models';
Copy link

Choose a reason for hiding this comment

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

Definition for rule 'jsx-a11y/anchor-is-valid' was not found jsx-a11y/anchor-is-valid


export {
googleStrategy, facebookStrategy, twitterStrategy, gitHubStrategy, SerializeSetUp
};
Copy link

Choose a reason for hiding this comment

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

Unexpected line break before this closing brace object-curly-newline

});
};

export {
Copy link

Choose a reason for hiding this comment

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

Unexpected line break after this opening brace object-curly-newline

@@ -0,0 +1,36 @@
import passport from 'passport';
Copy link

Choose a reason for hiding this comment

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

Definition for rule 'jsx-a11y/anchor-is-valid' was not found jsx-a11y/anchor-is-valid

@@ -0,0 +1,16 @@
import faker from 'faker';
Copy link

Choose a reason for hiding this comment

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

Definition for rule 'jsx-a11y/anchor-is-valid' was not found jsx-a11y/anchor-is-valid

@Alpha1202 Alpha1202 force-pushed the ft-Enable-Social-Login-166841012 branch from 178180b to 30f17f0 Compare July 8, 2019 10:56
done();
});
});

Copy link

Choose a reason for hiding this comment

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

Trailing spaces not allowed no-trailing-spaces

});
};
return Follow;
};
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 0 spaces but found 2 indent
Newline required at end of file but not found eol-last

onUpdate: 'CASCADE'
});
};
return Follow;
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 2 spaces but found 4 indent

onDelete: 'CASCADE',
onUpdate: 'CASCADE'
});
};
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 2 spaces but found 4 indent

foreignKey: 'id',
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
});
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 4 spaces but found 6 indent

type: DataTypes.STRING,
required: true
},
}, {});
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 2 spaces but found 4 indent

followId: {
type: DataTypes.STRING,
required: true
},
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 4 spaces but found 6 indent

const Follow = sequelize.define('Follow', {
followId: {
type: DataTypes.STRING,
required: true
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 6 spaces but found 8 indent

module.exports = (sequelize, DataTypes) => {
const Follow = sequelize.define('Follow', {
followId: {
type: DataTypes.STRING,
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 6 spaces but found 8 indent

@@ -0,0 +1,17 @@
module.exports = (sequelize, DataTypes) => {
const Follow = sequelize.define('Follow', {
followId: {
Copy link

Choose a reason for hiding this comment

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

Expected indentation of 4 spaces but found 6 indent

Copy link
Contributor

@fob413 fob413 left a comment

Choose a reason for hiding this comment

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

Please make these quick changes


const gitHubStrategy = new GitHubStrategy(githubConfig, socialCallBack);

const SerializeSetUp = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

please document this function (jsdocs)



let firstName, lastName;
let lName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 27 and 28, can be just a single line

social: userData.provider
}
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove all white spaces

@Alpha1202 Alpha1202 closed this Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants