Skip to content

tokens not working #80

Open
Open
@ZohebMOPO

Description

@ZohebMOPO

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,
        });
      }
    )
  );```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions