twauth-web icon indicating copy to clipboard operation
twauth-web copied to clipboard

Invalid response from Twitter API GET users/show: 403

Open woo2669 opened this issue 1 year ago • 2 comments

I have set the environment variables TWAUTH_APP_CONSUMER_KEY and TWAUTH_APP_CONSUMER_SECRET. App permissions are also set to Read and Write and Direct Message. The type of app is a Web App, Automated App, or Bot. The Callback URI / Redirect URL is http://127.0.0.1:5000/callback.

When running the program, I am able to retrieve values for oauth_denied, oauth_token, oauth_verifier, and oauth_store correctly. The browser also redirects to the Twitter authentication screen. However, upon returning to the application, an error occurs. I have tried adjusting the settings, but the issue persists.

woo2669 avatar Jun 04 '23 14:06 woo2669

For anyone having this issue, you can go into twauth-web.py and edit

show_user_url = 'https://api.twitter.com/1.1/users/show.json'

into

show_user_url = 'https://api.twitter.com/1.1/account/verify_credentials.json'

and it should work again

Reference: step 3 of

https://developer.twitter.com/en/docs/authentication/guides/log-in-with-twitter#convert-request-to-access-token

"A successful response contains the oauth_token, oauth_token_secret parameters. The token and token secret should be stored and used for future authenticated requests to the Twitter API. To determine the identity of the user, use GET account/verify_credentials."

khoitx-ugaming avatar Jun 27 '23 05:06 khoitx-ugaming

thank you friend, with your solution i had fix 403 error. but after that i got anohter error , may i ask do you have encountered this error? and how to Set the API connection to v2 and change the endpoint with this twauth-web project? :

❌ Error: [{'message': 'You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https:developer.twitter.com/en/portal/product', 'code': 453}]

kang000feng avatar Jul 01 '23 06:07 kang000feng