jaredhanson / jaredhanson/passport-github

tokens not working

Open
#80 2 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 am not sure if it's only with me or everyone has a problem with the package. My function never gets called? Is there a problem with the package?
This function never gets called:-
```
async (accessToken, refreshToken, userProfile, cb) => {
console.log(userProfile);
const profile = userProfile as unknown as UserProfile;
let user = await getRepository(User).findOne({
where: { githubId: profile.id },
});
```

My code:-
```passport.use(
new GitHubStrategy(
{
clientID: process.env.ID,
clientSecret: process.env.SECRET,
callbackURL: "http://localhost:4000/graphql",
},
async (accessToken, refreshToken, userProfile, cb) => {
console.log(userProfile);
const profile = userProfile as unknown as UserProfile;
let user = await getRepository(User).findOne({
where: { githubId: profile.id },
});
if (!user) {
user = await createUser({
username: profile.username || "",
email: profile.emails as unknown as string,
githubId: profile.id,
pictureUrl: profile._json.avatar_url,
});
}
cb(null, {
user,
accessToken,
refreshToken,
});
}
)
);```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the GitHubStrategy setup shown in the issue and trace whether the OAuth callback reaches the supplied verify function. Reproduce the flow using the provided callbackURL and inspect the authentication request and response. Done means identifying the cause of the missing callback or documenting it with a minimal reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, javascript, node.js
Domain
authentication
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.