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

Value passed for the authorization code was invalid. #496

Open
karanpokar opened this issue Aug 24, 2023 · 4 comments
Open

Value passed for the authorization code was invalid. #496

karanpokar opened this issue Aug 24, 2023 · 4 comments

Comments

@karanpokar
Copy link

Describe the bug
Getting Error while OAuth
Followed the documentation and getting this in the response. It worked for the first time and getting this for the rest of the tries.

Confidential Client

To Reproduce
Please indicate all steps that lead to this bug:

  1. const client = new TwitterApi({ clientId: 'Client', clientSecret: 'Secret' });
  2. client.loginWithOAuth2({ code:code from redirect url, codeVerifier:codeVerifier from generateOAuth2AuthLink , redirectUri: 'http://localhost:3000/twitter' })
  3. data: {
    error: 'invalid_request',
    error_description: 'Value passed for the authorization code was invalid.',
    errors: [ [Object] ]
    }

Expected behavior
Returns UserObject and Accesstoken

Version

  • 16.13.0
  • Lib version: 1.15.1
  • macOS 13.1 (22C65)
Screenshot 2023-08-24 at 1 21 02 PM Screenshot 2023-08-24 at 1 23 06 PM
@RitikDeqode
Copy link

I am also facing the same issue.
Did you find any solution for this?

@Cryptomancien
Copy link

We have all the same issue...

@clearloop
Copy link

clearloop commented Mar 4, 2024

  1. the following API is deprecated, see June 26 2023 in the Twitter API ChangeLog
  2. the issue could be caused by requesting an unsupported interface, for example, ur requesting currentUserV2 but you forgot to add users.read to the scope of the client config

@tus512
Copy link

tus512 commented Mar 6, 2024

In my case, remove 'offline.access' from scope array when generate auth link and it will work. But the response will not has refresh token, only access token.

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

5 participants