-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
install passport install passport-facebook install passport-google-oauth20 install passport-twitter initialise passport strategies [#166841012]
src/controllers/socialController.js
Outdated
}); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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
src/controllers/socialController.js
Outdated
static async socialUser(req, res) { | ||
try { | ||
const userData = req.authInfo; | ||
console.log(userData); |
There was a problem hiding this comment.
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 | ||
}; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
test/socialLogin.test.js
Outdated
.reply(200, 'Facebook connection established'); | ||
|
||
describe('passport strategy', () => { | ||
it('should be a function', (done) => { |
There was a problem hiding this comment.
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
test/socialLogin.test.js
Outdated
|
||
const accessToken = 'vubhjnklmewrtyu'; | ||
const refreshToken = 'jhvbknhjnkmknkl'; | ||
const profile = { |
There was a problem hiding this comment.
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
test/socialLogin.test.js
Outdated
import app from '../src/server'; | ||
|
||
const accessToken = 'vubhjnklmewrtyu'; | ||
const refreshToken = 'jhvbknhjnkmknkl'; |
There was a problem hiding this comment.
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
test/socialLogin.test.js
Outdated
import { socialCallBack } from '../src/helpers/helpers'; | ||
import app from '../src/server'; | ||
|
||
const accessToken = 'vubhjnklmewrtyu'; |
There was a problem hiding this comment.
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
test/mockStrategy.js
Outdated
passport.use(new MockStrategy('google', socialCallBack, randomSocialUser)); | ||
passport.use( | ||
new MockStrategy('facebook', socialCallBack, randomSocialUser) | ||
); |
There was a problem hiding this comment.
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
test/mockStrategy.js
Outdated
} | ||
|
||
passport.use(new MockStrategy('google', socialCallBack, randomSocialUser)); | ||
passport.use( |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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]
install passport install passport-facebook install passport-google-oauth20 install passport-twitter initialise passport strategies [#166841012]
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
src/controllers/socialController.js
Outdated
|
||
if (displayName) { | ||
firstname = displayName.split(' ')[0]; | ||
lastname = displayName.split(' ')[0]; |
There was a problem hiding this comment.
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
src/controllers/socialController.js
Outdated
const { displayName } = userData; | ||
|
||
if (displayName) { | ||
firstname = displayName.split(' ')[0]; |
There was a problem hiding this comment.
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
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…into ft-Enable-Social-Login-166841012
…into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
There was a problem hiding this 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
There was a problem hiding this 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
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
@@ -0,0 +1,68 @@ | |||
import chai, { expect } from 'chai'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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 | ||
}; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
@@ -0,0 +1,16 @@ | |||
import faker from 'faker'; |
There was a problem hiding this comment.
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
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…into ft-Enable-Social-Login-166841012
…into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
…into ft-Enable-Social-Login-166841012
…into ft-Enable-Social-Login-166841012
…/andela/ah-nyati-backend into ft-Enable-Social-Login-166841012
178180b
to
30f17f0
Compare
done(); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
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; | ||
}; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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' | ||
}); | ||
}; |
There was a problem hiding this comment.
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' | ||
}); |
There was a problem hiding this comment.
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 | ||
}, | ||
}, {}); |
There was a problem hiding this comment.
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 | ||
}, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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
There was a problem hiding this 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 = () => { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
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
What does this PR do?
Integrate Social Login for google, facebook and twitter
Description of Task to be completed?
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
Any background context you want to provide?
What are the relevant pivotal tracker stories?
Screenshots (if appropriate)
Questions: