Twitter OAuth Access Token Error: Request token missing
Asked Answered
O

2

7

I'm trying to run through a proof of concept social sign in flow with Twitter using Postman, following this guide: https://developer.twitter.com/en/docs/twitter-for-websites/log-in-with-twitter/guides/implementing-sign-in-with-twitter

I'm stuck on step 3: Converting the request token to an access token

I'm using Postman's built in Authorization for OAuth 1.0 and have provided values for my Consumer Key, Consumer Secret, Access Token, and Token Secret.

No matter what I try, the response from my POST to https://api.twitter.com/oauth/access_token is a 401:

Request token missing

I'm including my oauth_verifier from step 2 as x-www-form-urlencoded data.

My project is being developed with Laravel and Socialite. I've also tried using the getTokenCredentials method on the League\OAuth1\Client\Server\Server class and get the same Request token missing error.

My end goal is to use the userFromTokenAndSecret method provided by the Twitter Socialite driver to retrieve user profile data.

Has anyone encountered this error before?

Outlier answered 27/4, 2019 at 2:7 Comment(3)
are you sure you are sending in the correct token? for https://api.twitter.com/oauth/access_token, you have to use the token obtained from step 2. developer.twitter.com/en/docs/basics/authentication/overview/… https://yourWhitelistedCallbackUrl.com?oauth_token=NPcudxy0yU5T3tBzho7iCotZ3cnetKwcTIRlX0iwRl0&oauth_verifier=uw7NjWHT6OJ1MpJOXsHfNxoAhPKpgI8BlYDhxEjIBYExtract
Ah yes, I didn't realize the token would change per step. Thanks!Outlier
I have exactly the same issue but... in the example linked above, the request token remains the same at all steps? (it is oauth_token=NPcudxy0yU5T3tBzho7iCotZ3cnetKwcTIRlX0iwRl0 in step 2 and 3). Completely lost...Hunter
O
4

I didn't realize the token would also change per step. After using the correct tokens, I'm able to authenticate successfully with Twitter.

Outlier answered 5/5, 2019 at 20:51 Comment(0)
C
9

For users like me and @seinecle who were facing the issue despite having the right token, the Twitter's Postman collection has an issue. Simply change step-3's Authorization type to "No Auth" and send the request again.

EDIT: Link to postman collection - https://www.postman.com/twitter/workspace/twitter-s-public-workspace/collection/241622-2f1af03a-a3fe-4b8a-9b1a-bd0b84789e50

Clarkin answered 4/6, 2022 at 17:9 Comment(4)
This is correct answer if you are using the Twitter OAuth 1.0a flow test postman collection.Acrylyl
I am using the Twitter OAuth 1.0a postman collection and this is what I needed, thanks!Cystoscope
can you please tell me what is oauth_verifier and how can i get it from step-2?Lithiasis
oauth_verifier is passed as a query parameter in the request that Twitter sends to your callback url. @LithiasisMoonrise
O
4

I didn't realize the token would also change per step. After using the correct tokens, I'm able to authenticate successfully with Twitter.

Outlier answered 5/5, 2019 at 20:51 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.