I am trying to fully understand oAuth in Twitter implementation and am beating myself up a bit. I have read the documentation and am fairly confident that I understand the basic premise:
Step 1: Send a POST to: https://api.twitter.com/oauth/request_token
Step 2: Catch the token it returns
Step 3: Redirect user to twitter to sign in
Step 4: Catch result
I am stuck on step 1, with a 401 error being repeatedly returned.
I have created an application successfully. I gave the application read/write, DM permissions.
I have the 4 keys.
I have sync’d the clock on my computer to a public government ntp source.
I placed the header variables in alphabetic order.
I have regenerated both sets of keys.
When things didn’t work, I went to the most simple concept I could think of, using the oAuth Tool on the App website to generate a signature and pasted the variables into my code and executed (about a million times with different variants), yet I am still getting 401 errors returned. I get a new signature with the tool each time.
I have tried it with and without a callbackurl.
I have tried it with a callbackurl to a dev box using 127.0.0.1:xxxxx, with a production ssl url, and with the url set to “oob”, the result is the same - a 401 error.
If someone with more experience could shed some light and point me in a direction, I would be extremely grateful.
I am sending a POST to this URL: https://api.twitter.com/oauth/request_token
I am inserting the following text content into the header: Authorization: OAuth oauth_callback="{a valid url here}", oauth_consumer_key=“nKOrq7WMWxOfxE50xe2EVWv0d”, oauth_nonce=“4bfa5ea5445eebed6f40e8f3b6b9a47e”, oauth_signature=“QqXR9ZTQYqJDbpxVyiIkntF3Zdg%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1434147820”, oauth_version=“1.0”
Thank you in advance for your assistance.