Comments (5)
@jaredhanson What is the appropriate path for making sure that the solution to this problem isn't just "don't use a proxy"? I don't think the issue will be able to be solved in the light layer of passport - it's much deeper in the oauth lib. Just as an FYI there is a PR here for it: ciaranj/node-oauth#294
Maybe with a request coming from you, the author of oauth lib will consider merging this PR, which will allow you to close this open issue. I'm quite certain every other passportjs plugin/strategy has the exact same problem though
from passport-google-oauth.
500 failed to obtain access token (Error: connect ECONNREFUSED)
at D:\Chandrasekhar\NodeJs_Workspace\SkillsetMgmtNode\node_modules\passport-google-oauth\node_modules\passport-oauth\lib\passport-oauth\strategies\oauth2.js:125:38
at D:\Chandrasekhar\NodeJs_Workspace\SkillsetMgmtNode\node_modules\passport-google-oauth\node_modules\passport-oauth\node_modules\oauth\lib\oauth2.js:177:18
at ClientRequest. (D:\Chandrasekhar\NodeJs_Workspace\SkillsetMgmtNode\node_modules\passport-google-oauth\node_modules\passport-oauth\node_modules\oauth\lib\oauth2.js:148:5)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1547:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1440:17)
at Socket.emit (events.js:117:20)
at net.js:440:14
at process._tickCallback (node.js:419:13)
PassportJs Code
app.get('/auth/google', passport.authenticate('google', { session: false,
accessType: 'offline',
approvalPrompt: 'force' }));
passport.use(new GoogleOAuth2Strategy({
clientID : configAuth.googleAuth.clientID,
clientSecret: configAuth.googleAuth.clientSecret,
callbackURL: configAuth.googleAuth.callbackURL,
scope: ['profile', 'email', 'openid'],
passReqToCallback : true
},
function(accessToken, refreshToken, profile, done) {
console.log(params.expires_in);
console.log(profile.id);
process.nextTick(function() {
// try to find the user based on their google id
User.findOne({ 'google.id' : profile.id }, function(err, user) {
if (err)
return done(err);
if (user) {
// if a user is found, log them in
return done(null, user);
} else {
// if the user isnt in our database, create a new user
var newUser = new User();
// set all of the relevant information
newUser.google.id = profile.id;
newUser.google.token = accessToken;
newUser.name = profile.displayName;
newUser.google.name = profile.displayName;
newUser.google.email = profile.emails[0].value; // pull the first email
console.log(profile.id);
console.log(accessToken);
console.log(profile.displayName);
console.log(profile.emails[0].value);
// save the user
newUser.save(function(err) {
if (err)
throw err;
return done(null, newUser);
});
}
});
});
}));
from passport-google-oauth.
Hi,
Can you please provide the solution for the above issue ??
from passport-google-oauth.
I ran into the same problem and in my case using a proxy server caused a problem. To be more specific an error was occurred doing a POST to https://accounts.google.com/o/oauth2/token
glad if it helps.
from passport-google-oauth.
As @kalinichenko mentioned , the error is because you are behind a proxy , Try running it without proxy . Hope it should work beacause it worked for me .
from passport-google-oauth.
Related Issues (20)
- OAuth2Strategy requires a verify callback how to fix it? HOT 12
- InternalOAuthError "message": "failed to obtained request token" HOT 2
- Support include_granted_scopes [feature request] HOT 1
- how to get the idtoken in the callback for googleStrategy
- Getting user birthday HOT 3
- passReqToCallback slightly inconsistent with Express, doc update? HOT 1
- Passport session not store on google login HOT 1
- Missing required parameter: scope" in app serverless HOT 2
- Changelog for version 2? HOT 1
- Can not get user domain with version 2.0 HOT 4
- howto solve this?
- Disconnecting app from Google account
- PWA and auth link
- id_token
- Restrict To Server Side validation (Needed Feature to verify idToken )
- Error 400: invalid_request Missing required parameter: redirect_uri HOT 1
- InternalOAuthError: Failed to obtain access token HOT 3
- Error 403: disallowed_useragent for a node.js web-site
- Race Condition , accepting new requests before the session of first user finishes HOT 1
- Failed to serialize user into session
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from passport-google-oauth.