Next.js Discord

Discord Forum

Linking paypal

Unanswered
Bombay posted this in #help-forum
Open in Discord
BombayOP
I am trying to link paypal to user's account and i'm getting this error all the time, I am using next-auth:

[next-auth][error][OAUTH_CALLBACK_ERROR]
https://next-auth.js.org/errors#oauth_callback_error id_token not present in TokenSet {
  error: TypeError: id_token not present in TokenSet
      at Client.validateIdToken (/app/node_modules/openid-client/lib/client.js:758:15)
      at Client.callback (/app/node_modules/openid-client/lib/client.js:505:18)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async oAuthCallback (/app/node_modules/next-auth/core/lib/oauth/callback.js:109:16)
      at async Object.callback (/app/node_modules/next-auth/core/routes/callback.js:52:11)
      at async AuthHandler (/app/node_modules/next-auth/core/index.js:208:28)
      at async NextAuthApiHandler (/app/node_modules/next-auth/next/index.js:22:19)
      at async NextAuth._args$ (/app/node_modules/next-auth/next/index.js:108:14) {
    name: 'OAuthCallbackError',
    code: undefined
  },
  providerId: 'paypal',
  message: 'id_token not present in TokenSet'
}


This is the snippet of [...nextauth].ts:

    {
      id: "paypal",
      name: "Paypal",
      type: "oauth",
      authorization: {
        url: "https://www.sandbox.paypal.com/signin/authorize",
        params: { scope: "openid profile email" },
      },
      token: "https://api-m.sandbox.paypal.com/v1/oauth2/token",
      userinfo: "https://api-m.sandbox.paypal.com/v1/oauth2/token/userinfo",
      jwks_endpoint: "https://api-m.sandbox.paypal.com/v1/oauth2/certs",
      clientSecret: process.env.PAYPAL_SECRET,
      clientId: process.env.PAYPAL_ID,
      allowDangerousEmailAccountLinking: true,
      idToken: true,
      profile(profile) {
        return {
          id: profile.sub,
          name: profile.name,
          email: profile.email,
          image: profile.picture,
        };
      },
    },

1 Reply

BombayOP
bump