Full-Stack Web Development with Vue.js and Node

(singke) #1
Building OAuth Strategies with passport.js Chapter 7

Fill in the privacy policy and terms of service URLs, and then under the Permissions tab,
check the checkbox that says Request email addresses from users and click on Update


Settings:


The last thing we also need is to specify the resource URL to be able to access the email


address, which we do by adding the following in twitter.js:


...
passport.use(new Strategy({
consumerKey: config.TWITTER_APP_ID,
consumerSecret: config.TWITTER_APP_SECRET,
userProfileURL:
"https://api.twitter.com/1.1/account/verify_credentials.json?
include_email=true",
callbackURL: '/login/twitter/return',
},
...

Now, everything is ready to go for the Twitter login. We should be able to log in
successfully with the LOGIN WITH TWITTER button now.

Free download pdf