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

TokkenError: Bad Request #43

Open
ManLikeGhost opened this issue Dec 1, 2018 · 2 comments
Open

TokkenError: Bad Request #43

ManLikeGhost opened this issue Dec 1, 2018 · 2 comments

Comments

@ManLikeGhost
Copy link

THIS IS MY CODE:
`const express = require('express') ;
const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy
const keys = require('./config/keys');

const app = express();

passport.use(new GoogleStrategy({
clientID: keys.googleClientID,
clientSecret: keys.googleClientSecret,
callbackURL:'/auth/google/callback'
}, (accessToken, refreshToken, profile, done) => {
console.log('accessToken', accessToken);
console.log('refreshToken', refreshToken);
console.log('profile', profile);
})
);

app.get('/auth/google', passport.authenticate('google', {
scope:['profile','email']
}));

app.get('/auth/google/callback', passport.authenticate('google'));

const PORT = process.env.PORT || 5000;
app.listen(PORT);

===================================================================

ERROR : ekpo eddy@EDDY MINGW64 ~/Desktop/nodeproject/server (master)
$ node index.js
accessToken ya29.GltlBkOxTgYv2Usrc-uZ30FcYEz6kjEpSoJMWTZiRlFgQs1MMdTqyMCEQggFFJD
QwRPnRmtDrDpvsIVfSD824t6Ux40gnJpXP2B-RRKIWUYIMlQPNq0934adRJKm
refreshToken undefined
profile { id: '115683550688654773269',
displayName: 'Edet Ekpo',
name: { familyName: 'Ekpo', givenName: 'Edet' },
emails: [ { value: '[email protected]', type: 'account' } ],
photos:
[ { value:
'https://lh5.googleusercontent.com/-_W9wyfmpojs/AAAAAAAAAAI/AAAAAAAAAB0/
tpQ0uHFeRWA/photo.jpg?sz=50' } ],
gender: undefined,
provider: 'google',
_raw:
'{\n "kind": "plus#person",\n "etag": "\"jb1Xzanox6i8Zyse4DcYD8sZqy0/O1bz5ZX
VnfSXOnS8IimFT_xk7GE\"",\n "emails": [\n {\n "value": "[email protected]
m",\n "type": "account"\n }\n ],\n "objectType": "person",\n "id": "115683550
688654773269",\n "displayName": "Edet Ekpo",\n "name": {\n "familyName": "Ekpo"
,\n "givenName": "Edet"\n },\n "url": "https://plus.google.com/1156835506886547
73269",\n "image": {\n "url": "https://lh5.googleusercontent.com/-_W9wyfmpojs/A
AAAAAAAAAI/AAAAAAAAAB0/tpQ0uHFeRWA/photo.jpg?sz=50",\n "isDefault": false\n },
n "isPlusUser": true,\n "language": "en",\n "circledByCount": 0,\n "verified": f
alse\n}\n',
_json:
{ kind: 'plus#person',
etag: '"jb1Xzanox6i8Zyse4DcYD8sZqy0/O1bz5ZXVnfSXOnS8IimFT_xk7GE"',
emails: [ { value: '[email protected]', type: 'account' } ],
objectType: 'person',
id: '115683550688654773269',
displayName: 'Edet Ekpo',
name: { familyName: 'Ekpo', givenName: 'Edet' },
url: 'https://plus.google.com/115683550688654773269',
image:
{ url:
'https://lh5.googleusercontent.com/-_W9wyfmpojs/AAAAAAAAAAI/AAAAAAAAAB0
/tpQ0uHFeRWA/photo.jpg?sz=50',
isDefault: false },
isPlusUser: true,
language: 'en',
circledByCount: 0,
verified: false } }
accessToken ya29.GltlBjdmG2SjB9GrRxrV0C7Ax66aWndCN0cAiNbb2uigQaYtfnYNvdtae1DK41f
lEkgbe4257OUh4mbGNRxeNfSNR-WXf2WkNt635jakrIXAUQslddWnammL3ERk
refreshToken undefined
profile { id: '115683550688654773269',
displayName: 'Edet Ekpo',
name: { familyName: 'Ekpo', givenName: 'Edet' },
emails: [ { value: '[email protected]', type: 'account' } ],
photos:
[ { value:
'https://lh5.googleusercontent.com/-_W9wyfmpojs/AAAAAAAAAAI/AAAAAAAAAB0/
tpQ0uHFeRWA/photo.jpg?sz=50' } ],
gender: undefined,
provider: 'google',
_raw:
'{\n "kind": "plus#person",\n "etag": "\"jb1Xzanox6i8Zyse4DcYD8sZqy0/O1bz5ZX
VnfSXOnS8IimFT_xk7GE\"",\n "emails": [\n {\n "value": "[email protected]
m",\n "type": "account"\n }\n ],\n "objectType": "person",\n "id": "115683550
688654773269",\n "displayName": "Edet Ekpo",\n "name": {\n "familyName": "Ekpo"
,\n "givenName": "Edet"\n },\n "url": "https://plus.google.com/1156835506886547
73269",\n "image": {\n "url": "https://lh5.googleusercontent.com/-_W9wyfmpojs/A
AAAAAAAAAI/AAAAAAAAAB0/tpQ0uHFeRWA/photo.jpg?sz=50",\n "isDefault": false\n },
n "isPlusUser": true,\n "language": "en",\n "circledByCount": 0,\n "verified": f
alse\n}\n',
_json:
{ kind: 'plus#person',
etag: '"jb1Xzanox6i8Zyse4DcYD8sZqy0/O1bz5ZXVnfSXOnS8IimFT_xk7GE"',
emails: [ { value: '[email protected]', type: 'account' } ],
objectType: 'person',
id: '115683550688654773269',
displayName: 'Edet Ekpo',
name: { familyName: 'Ekpo', givenName: 'Edet' },
url: 'https://plus.google.com/115683550688654773269',
image:
{ url:
'https://lh5.googleusercontent.com/-_W9wyfmpojs/AAAAAAAAAAI/AAAAAAAAAB0
/tpQ0uHFeRWA/photo.jpg?sz=50',
isDefault: false },
isPlusUser: true,
language: 'en',
circledByCount: 0,
verified: false } }
TokenError: Bad Request
at Strategy.OAuth2Strategy.parseErrorResponse (C:\Users\ekpo eddy\Desktop\no
deproject\node_modules\passport-oauth2\lib\strategy.js:329:12)
at Strategy.OAuth2Strategy.createOAuthError (C:\Users\ekpo eddy\Desktop\nod
eproject\node_modules\passport-oauth2\lib\strategy.js:376:16)
at C:\Users\ekpo eddy\Desktop\nodeproject\node_modules\passport-oauth2\lib\s
trategy.js:166:45
at C:\Users\ekpo eddy\Desktop\nodeproject\node_modules\oauth\lib\oauth2.js:1
91:18
at passBackControl (C:\Users\ekpo eddy\Desktop\nodeproject\node_modules\oaut
h\lib\oauth2.js:132:9)
at IncomingMessage. (C:\Users\ekpo eddy\Desktop\nodeproject\node

modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1098:12)
at process.internalTickCallback (internal/process/next_tick.js:72:19)

`

@dhuang612
Copy link

under http://console.developers.google.com do you have a separate google + api key generated for dev and prod?

@dennnis0204
Copy link

I have changed my own password with '@' sign to Autogenerate Secure Password in MongoDB Atlas

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

No branches or pull requests

3 participants