63

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."
    }
  ]
}
2

9 Answers 9

82

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

12
  • 12
    I don't have Auto add parameter Mar 29, 2016 at 4:27
  • 4
    Postman was updated after I posted this answer. In the current version I am using only 'Add params to header'. Jun 9, 2016 at 21:33
  • 4
    I cannot make it work! I tried Pratik solution, setting the nonce to 32 chars length, but nothing, still having the code 32. I don't wan't to duplicate the question, but need some help. thanks Aug 8, 2016 at 4:13
  • 1
    Make sure that your include a user_id or user_name parameter on the request or Twitter will not authenticate the request. I have it working with a 6 character nonce and "Add params to Header" only checked
    – D. Gibbs
    Oct 19, 2016 at 17:54
  • 3
    This works in 2018 ..! Thanks 🙏. The Postman client has been changed its UI and there is a dialog box called "Add authorization data to", We should select the "Request Headers". Apr 29, 2018 at 5:04
27

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

0
7

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

1
  • 2
    I don't understand
    – Haha TTpro
    Oct 4, 2017 at 4:27
6

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

enter image description here

1
4

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

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

2

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

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

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.