pilcrowOnPaper / arctic

OAuth 2.0 clients for popular providers

Home Page:https://arctic-reddit.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solving Twitter provider (403 Forbidden)

CharlesBT opened this issue · comments

Hi I struggled with that the whole day
using scopes: ['users.read'] produces an accessToken that is rejected by Twitter API : 403 Forbiden when requesting endpoint : https://api.twitter.com/2/users/me

In order to have it working we need to use : scopes: ['tweet.read', 'users.read', 'follows.read', 'follows.write'] as mentionned in doc : https://developer.twitter.com/en/docs/authentication/oauth-2-0/user-access-token

You can update the doc accordingly.

PS : even with request email enabled on twitter app options, the email can not be provided using https://api.twitter.com/2/users/me endpoint.
After many research it seems that email can only be retrieved using the OAuth 1.0a twitter api 👍

usefull sources for email retrieval 👍 https://www.reddit.com/r/Twitter/comments/yxo7ku/how_to_retrieve_user_email_with_twitter_api_v2/
https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials#:~:text=Request%20a%20User's%20Email%20Address,email%20address%20access%20to%20function.
https://lurumad.github.io/identityserver4-retrieving-an-user-s-email-from-twitter-external-login-account-copy-2

Fixed (You only need users.read and tweet.read to get the user btw)

Ok thanks