jaredhanson / jaredhanson/passport-github

InternalOAuthError: Failed to fetch user profile

Open
#84 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
535
Forks
290
PR merge metrics
No merged PRs in 30d

Description

I got this error
InternalOAuthError: Failed to fetch user profile
at C:\Esercizi\node2\node_modules\passport-github2\lib\strategy.js:98:19
at ClientRequest. (C:\Esercizi\node2\node_modules\oauth\lib\oauth2.js:162:5)
at ClientRequest.emit (node:events:537:28)
at TLSSocket.socketErrorListener (node:_http_client:465:9)
at TLSSocket.emit (node:events:537:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

const githubStrategy = new passportGitHub2.Strategy(
{
clientID: config.CLIENT_ID,
clientSecret: config.CLIENT_SECRET,
callbackURL: config.CALLBACK_URL,
// skipUserProfile: true

},
function (
accesToken: string,
refreshToken: string,
profile: { [key: string]: string },
done: (error: null, user: Express.User) => void
) {
const user: Express.User = {
username: profile.username,
};

done(null, user);
}
);

I am afraid this fail and i don'know why
passport.authenticate("github", {
scope: ["user:email"],
})

I double checked the ID and secret and the call back url. It's all fine, even the call backurl is fine and I can contact github.
I am able to receive the login page of github, authorize the use but then i receive this error. Any clue?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading lib/strategy.js at the reported line and oauth/lib/oauth2.js around line 162, then reproduce the callback with the shown Passport configuration. Done would require identifying a repository-level cause and adding a regression test, but the report does not specify an expected behavior or failing test.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, javascript, node.js
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.