I’m try to request call this route /2/users/:id/following also getting the error :

Authenticating with OAuth 2.0 Application-Only is forbidden for this endpoint. Supported authentication types are [OAuth 1.0a User Context, OAuth 2.0 User Context].

I’ve trying to understand how I should generate an oauth token valid for this request, but i’m a bit lost! I’ve all the pipe line for the user authentication and for the last request I can get all user data including userToken and tokenSecret how i can use that info to generate the token for my request?

Also I’ve try to generate a token generate with apiKey and apiSecret withtou success

curl -u ‘apiKey:apiSecret’
–data ‘grant_type=client_credentials’
‘/oauth2/token’

I’m really lost using twitter api because of the multiples ways to authenticate

it must use user context authentication, you cannot use application only authentication. What programming language do you use to build applications?

Thanks for reaching out! To use OAuth 2.0 with this endpoint, you can use the method outlined here. Or OAuth 1.0a. How are you trying to call this endpoint?

1 Like

tks for your reply.

I’ve implement the user auth flow on my website. So i’ve all token needed userToken and userTokenSecret and also username and user_id. What i’m not understand is how i can use this tokens to request that route /2/users/:id/following.

I need the Bearer token. the question is how I can get Bearer token for that user from user credentials? Or i can to that call just using my app credentials?