hi everyone
So i have that problem and i hope u help me
am trying to post a request for request token and i try a lot and it give Could not authenticate you

i followed (Creating a signature | Docs | Twitter Developer Platform) to get the signature

POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&include_entities%3Dtrue%26oauth_callback%3Dhttps%25253A%25252F%25252Fmy-shop-server.herokuapp.com%25252Fapi%25252Fv1%25252Ftest%25252Ftwitter%25250A%26oauth_consumer_key%3Dw...V%26oauth_nonce%3DsPnQLwZMIBjjbZIJzlwWYAbboUlNDgYy%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1611428547%26oauth_version%3D1.0

consumer key secret

8...E

and i got the signature base64 encoded

P...8=

the Authorization Header:

OAuth oauth_nonce="sPnQLwZMIBjjbZIJzlwWYAbboUlNDgYy",oauth_callback="https%253A%252F%252Fmy-shop-server.herokuapp.com%252Fapi%252Fv1%252Ftest%252Ftwitter%250A",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1611428547",oauth_consumer_key="w...V",oauth_signature="P..D",oauth_version="1.0"

and am using this

Response response = await post("https://api.twitter.com/oauth/request_token",
        headers: {
          "Authorization": authHeader,
          "Content-Type": "application/json"
        });

all get is 401 Could not authenticate

hi there i solved that problem
it was the auth_callback
i encoded it and put it in the function which code it again before sending it .
i dont know why i do it in the first place but that was the problem .

1 Like

Is this C# or Dart or something?

I would not recommend trying to implement your own oauth stuff - is there a library you can use instead?

Also, be careful with including your consumer keys anywhere public: Authentication best practices | Docs | Twitter Developer Platform

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.