passBackControl errors
See original GitHub issueError
at /Users/theonlygusti/Project/node_modules/passport-google-oauth20/lib/strategy.js:95:21
at passBackControl (/Users/theonlygusti/Project/node_modules/oauth/lib/oauth2.js:132:9)
at IncomingMessage.<anonymous> (/Users/theonlygusti/Project/node_modules/oauth/lib/oauth2.js:157:7)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
I get the above error after: going to /sign-in/go
, clicking my google account from the list google gives me, then … error (url looks like http://localhost:61337/sign-in/after?code=4/BIsK3AIVt0p-Lk5ZGsyVqrv3KG3FevvO_ZPeKTwF6Tm#
at this stage.)
Here’s my code:
const express=require('express');
const app = express();
const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy;
passport.use(new GoogleStrategy({
clientID: process.env.GOOGLE_OAUTH_CLIENT_ID,
clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET,
callbackURL: '/sign-in/after'
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ googleId: profile.id }, function (err, user) {
return cb(err, user);
});
}));
app.get('/sign-in/go', passport.authenticate('google', { scope: ['profile'] }));
app.get('/sign-in/after',
passport.authenticate('google', { failureRedirect: '/sign-in' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
const httpServer = app.listen(app.get('port'));
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
node.js - Passport.js OAuth2 TokenError -> OAuth2Strategy ...
Anyway, the App works fine until it comes to the /callback part, where I get this error (in the console and as the...
Read more >Social Authentication with Passport.js - Michael Herman
In this post we'll add social authentication - Facebook, Twitter, Github, Google, and Instagram - to Node.js.
Read more >Google login form trouble - Coding Help - Glitch Support
Hello everybody, i had a code that was working around a month ago, but now i have this error, anyone can explain why?...
Read more >Error: failed to fetch user profile - Auth0 Community
Error : failed to fetch user profile at /var/www/app/node_modules/passport-auth0/lib/index.js:181:28 at passBackControl ...
Read more >Getting many errors on Twitter authentication process with c9 ...
Hello all, I've been getting a couple of errors when trying to process Twitter authentication process (login) on c9.io.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@theonlygusti I was just having this error, make sure you enabled the Google+ API in the developer console.
Hi @highviewstudios, best to store it as an environment variable on your deployment server, and access it via
process.env.GOOGLE__API_KEY
in your application code or something like that. Storing it in the code is never advisable.