node-twitter-api-v2
node-twitter-api-v2 copied to clipboard
Value passed for the authorization code was invalid.
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:
- const client = new TwitterApi({ clientId: 'Client', clientSecret: 'Secret' });
- client.loginWithOAuth2({ code:code from redirect url, codeVerifier:codeVerifier from generateOAuth2AuthLink , redirectUri: 'http://localhost:3000/twitter' })
- 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)
I am also facing the same issue. Did you find any solution for this?
We have all the same issue...
- the
followingAPI is deprecated, seeJune 26 2023in the Twitter API ChangeLog - the issue could be caused by requesting an unsupported interface, for example, ur requesting
currentUserV2but you forgot to addusers.readto the scope of the client config
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.