When calling the request_token API using curl, the response varies depending on the cookie value.
response 200
curl -L -v -X POST -H "Cookie:Version=0; ASP.NET_SessionId=usyamh55tejim4vhynlwejna; Path=/, Version=0; TS01c1468f=01b2fc18ecbeb7b7140f6ea78d470c01c2468d4a0b7b89777eae41c029704d5c6a7661ad4984df821bda4ba0827aee1307b0dce894; Path=/" -H "Authorization: OAuth oauth_consumer_key=\"xxxxxxxxxxx\", oauth_nonce=\"yyyyyyyyyyyyyy\", oauth_signature=\"zzzzzzzzzz\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1536633514\", oauth_callback=\"https%3A%2F%2Fhghg.jp\", oauth_version=\"1.0\"" https://api.twitter.com/oauth/request_token
response 500
curl -L -v -X POST -H "Cookie:\$Version=0; ASP.NET_SessionId=usyamh55tejim4vhynlwejna; \$Path=/, \$Version=0; TS01c1468f=01b2fc18ecbeb7b7140f6ea78d470c01c2468d4a0b7b89777eae41c029704d5c6a7661ad4984df821bda4ba0827aee1307b0dce894; \$Path=/" -H "Authorization: OAuth oauth_consumer_key=\"xxxxxxxxxxx\", oauth_nonce=\"yyyyyyyyyyyyyy\", oauth_signature=\"zzzzzzzzzz\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1536633514\", oauth_callback=\"https%3A%2F%2Fhghg.jp\", oauth_version=\"1.0\"" https://api.twitter.com/oauth/request_token
*Parameters are masked
I am in trouble because the cause is unknown.
Help me.
abraham
#2
You shouldn’t need to include any cookies for that API endpoint.
1 Like
Hi abraham
Thank you for answering.
Since I got an error when accessing this API endpoint from yesterday, I was investigating.
After checking the Request, since the cookie was set in the Request header, I set the cookie and accessed it.
Is there information such as error when setting cookie?
You do not need to set a Cookie: header when calling any of the Twitter API endpoints. You do require a valid OAuth header.