ghaiklor / passport-google-plus-token

Passport strategy for authenticating with Google Plus via OAuth2 access tokens
http://ghaiklor.github.io/passport-google-plus-token/
MIT License
23 stars 11 forks source link

Issue with URL #194

Open Rakshak1344 opened 4 years ago

Rakshak1344 commented 4 years ago

here is the strategy used

//GOOGLE PLUS STRATEGY
const GooglePlusTokenStrategy = require('passport-google-plus-token').Strategy

//local-imports
const { JWT_SECRET, GOOGLE_CLIENT_SECRET, GOOGLE_CLIENT_ID } = require('./config/index')

passport.use('googleToken',new GooglePlusTokenStrategy({
    clientID: GOOGLE_CLIENT_ID,
    clientSecret: GOOGLE_CLIENT_SECRET,
    authorizationURL: 'https://accounts.google.com/o/oauth2/auth',
    tokenURL: 'https://accounts.google.com/o/oauth2/token',
}, function (req, accessToken, refreshToken, profile, next) {
    console.log('accessToken', accessToken)
    console.log('refreshToken', refreshToken)
    console.log('profile', profile)
}));

here is my route file

const passport = require('passport')
require('../passport')

router.route('/oauth/google')
    .post(passport.authenticate('googleToken', { session: false }))

module.exports = router

If I am not wrong, I think It is the issue with URL

    authorizationURL: 'https://accounts.google.com/o/oauth2/v2/auth',
    tokenURL: 'https://accounts.google.com/o/oauth2/v2/token',

If I don't provide the above URL, I am getting an error

TypeError: OAuth2Strategy requires a authorizationURL option
TypeError: OAuth2Strategy requires a tokenURL option

please help me out with this issue.

ghaiklor commented 4 years ago

@Rakshak1344 your code is totally differs from what we are saying in documentation - https://github.com/ghaiklor/passport-google-plus-token#usage