61
votes

I have followed the steps required to create a new application and getting consumer key, secret pairs and also the token access details. Now I would like to make calls to Twitter Rest API, using chrome Postman client.

How should I pass the customer key, secret, token etc details to the request? I have tried to pass them as headers and also tried to pass them by selecting OAuth1.0 option in postman client but I am getting errors:

{
  "errors": [
    {
      "code": 32,
      "message": "Could not authenticate you."
    }
  ]
}
9
Try following the steps mentioned hereelssar
For anyone wondering, there is now a Twitter Public Workspace that walks you through using the Twitter API directly in Postman with complete documentation: postman.com/twitter/workspace/twitter-s-public-workspace/…Arlemi

9 Answers

79
votes

I know this is old, but in case anyone is still facing this issue, the following steps worked for me:

  1. In Authorization tab, select OAuth 1.0
  2. Enter your consumer key, consumer secret, access token and access token secret
  3. Enable “Add params to header” and “Auto add parameters”
  4. Send the request

enter image description here

I hope that helps.

25
votes

Juliana Chahoud's answer updated for 2018:

The add authorization data has been moved to the left column and requires you to select the drop down menu to change it to "Request Headers".

Postman 2018

7
votes

Postman creates 6 character nonce, Twitter needs 32-character Nonce. So you can use any random value, I used ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 (length=32)

6
votes

You must not pick Add params to header (pick will failed) You don't need to care about Nonce

enter image description here

3
votes

Add authorization data to "Request Headers"

Example Twitter API: https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=snap

enter image description here

This will generate the Authorization header. Make sure this has been generated.

enter image description here

Result

[
    {
        "created_at": "Wed Mar 01 19:37:16 +0000 2017",
        "id": 837023955454201857,
        "id_str": "837023955454201857",
        "text": "RT @yoda: other things @snap has potentially worked on:\n\ntinker toys\nbaseball cards\nonesies\ntaco tosser\nshrunken christmas tree\nwalkie talk…",
        "truncated": false,
        "entities": {
            "hashtags": [],
            "symbols": [],
            "user_mentions": [
                {
                    "screen_name": "yoda",
                    "name": "drew olanoff",
...
2
votes

For me, Postman created 11 character Nonce. I got the correct Twitter API response with the 11 character Nonce.

2
votes

If anyone reaches this in 2017, my problem was the nonce too but the one with length 32 didn't work for me. I checked the tutorial and used the one posted there and it started working. Make sure you choose postman to add the authorization data to the headers and not the body.

This is my working nonce: kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg

2
votes

After following the accepted answer, make sure there are no empty spaces at the end of the token/secret key. Otherwise, it will throw the same error Could not authenticate you.enter image description here

1
votes

Apart from the authentication settings that are taken from twitter developer console, when searching q=target_user_id it worked as opposed from q=@target_user_id, where I got the error 32, could not authenticate you.

So, after numerous attempts, what made a difference was just removing the "@" symbol from the q parameter value.