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

tokens not working #80

Open
ZohebMOPO opened this issue Oct 31, 2021 · 2 comments
Open

tokens not working #80

ZohebMOPO opened this issue Oct 31, 2021 · 2 comments

Comments

@ZohebMOPO
Copy link

ZohebMOPO commented Oct 31, 2021

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:-

    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,
        });
      }
    )
  );```
@Dani-error
Copy link

yeah got the same issue, do you fixed it?

@Dani-error
Copy link

actually, the problem was that I put the wrong callback URL

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

2 participants