Unable to get request token for my app TwitterListMyDemo

ios

#1

I am using https://api.twitter.com/oauth/request_token api to fetch oauth_token for my app. I am getting the error {“errors”:[{“code”:32,“message”:“Could not authenticate you.”}. I have rechecked and every information in the Authorization field is correct. Please allow access to my app.

Thanks in advance.


#2

You should probably post some of your code to understand what you’re doing wrong. Almost all of us have had that problem at least once and in most cases it’s been a typo or a detail in our code.


#3

{

Authorization = "OAuth oauth_callback=“twitterlistmydemo%3A%2F%2Fsuccess%2F”, oauth_consumer_key=“iFD43xOsYhovALC7PMPeGhK58”, oauth_nonce=“7537F128-D398-4494-8E95-982A4C96E82B”, oauth_signature=“VrAylhhdeKUqOzkOQLNX03vv92Y%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1551785440”, oauth_token=“64971235-jK2JU7f99xzVGhq99Ocz2CeyqO1mT8XzpVpnvh32i”, oauth_version=“1.0"”;

} This is the authorization header I am using. To generate the signature I am using the same method as provided by Swifter library in Swift. Its giving authorization error on my request. But when I try it from there demo apps its working fine. So I cannot say there is anything wrong with my request headers.


#4

Ok, there’s something I’m not getting. You say you want to get the access token in your question’s title, but you also say you’re having trouble with oauth/request_token, which is not the endpoint to get the access token (the endpoint to get the access token is oauth/access_token).

If it really is the request token you’re having trouble with, then you shouldn’t be putting any oauth_token in both authorisation and signature, because you have not generated any tokens yet (that’s why you are “requesting” your first token with oauth/request_token).

So, under the assumption that you’re having problems with the request of the token, your code should look like this:

{

**Authorization = "OAuth oauth_callback=“twitterlistmydemo%3A%2F%2Fsuccess%2F”, oauth_consumer_key=“iFD43xOsYhovALC7PMPeGhK58”, oauth_nonce=“7537F128-D398-4494-8E95-982A4C96E82B”, oauth_signature=“VrAylhhdeKUqOzkOQLNX03vv92Y%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1551785440”,  oauth_version=“1.0"”;**

}

…And the signature will be different too, because you’ve created yours using a token that doesn’t exist yet.

Best of luck!