Roie Yechi
Roie Yechi

Reputation: 21

Twitter OAuth v2 bug when user use Sign in with Google to sign in to twitter

providers: [
TwitterProvider({
  clientId: process.env.TWITTER_CLIENT_ID!,
  clientSecret: process.env.TWITTER_CLIENT_SECRET!,
  version: '2.0',
  authorization: {
    url: 'https://x.com/i/oauth2/authorize',
    params: {
      scope: 'users.read tweet.read offline.access',
    },
  },
}),
],

I am using Twitter OAuth v2 with next-auth for my website so my users could connect their twitter to their account. While I redirect a user to x/i/oauth2/authorize?redirect_uri=…&… page with required query params so he could authorize my app to access his x account, in case he is not signed in and use sign in with google to sign in they will be redirected to their x home page and won’t be redirected to my redirect_uri which is specified in the query params.

I came across this: https://devcommunity.x.com/t/twitter-oauth-v2-bug-when-user-use-sign-in-with-google-to-sign-in-to-twitter/169651

but it wasn't solved it seems on November 2024, does anyone have a solution maybe ?

Upvotes: 2

Views: 53

Answers (1)

Tinotenda Alfaneti
Tinotenda Alfaneti

Reputation: 11

Not really a solid solution, but currently just prompt users to verify they’re logged in to X before initiating the OAuth flow. It’s a bug on Twitter’s side that will need to be resolved by them, I guess. Will be happy to here other workarounds on this issue.

Upvotes: 0

Related Questions