4
votes

I am trying to make a POST request to this endpoint: https://api.twitter.com/oauth/request_token (as a first step of implementing Twitter sign in)

As it says in the docs: https://dev.twitter.com/oauth/reference/post/oauth/request_token that does not require authentication. However, when I try it, I get the following response:

{
    "errors": [
        {
            "code": 215,
            "message": "Bad Authentication data."
        }
    ]
}

Obviously I'm doing something wrong. I have a registered app and the consumer key/secret that goes with it and I'm not sure whether I need to use those somehow (in which case it's odd that it says in the docs that this endpoint does not require authentication).

Anyone has experience with this?

EDIT: Request example

curl -X POST -d "{'oauth_callback':'http://www.callback-url.com/'}" --header "Content-Type:application/json" https://api.twitter.com/oauth/request_token

Also tried without setting the Content-Type header.

1
We won't be able to help if we can't see the request that you're sending. - DWRoelands

1 Answers

4
votes

You need to construct a full OAuth authentication string and put it in the header of the request. See POST oauth/request_token for an example.