Search code examples
apirestpostmansalesforceaccess-token

Getting error while making access token request from Headers (Postman)


While making access token request from Headers, I'm getting below error.

Error- { "error": "unsupported_grant_type", "error_description": "grant type not supported" }

Am I doing something wrong or missing something? Please help!

Attached screenshot- enter image description here


Solution

  • You used wrong tab.

    Headers should be just 1-2:

    Content-Type:application/x-www-form-urlencoded
    Accept:application/json
    

    Your actual params are supposed to go to the body. Which you can type in manually or in postman's bulk edit syntax it'll be

    grant_type:password
    client_id:3MVG97sr...
    client_secret:CE6C05...
    username:example@example.com
    password:Hunter2
    

    If you're stuck - edit your question with the postman's "code" output (HTTP or cURL are probably best for wider audience to help you), just edit out the sensitive bits.

    enter image description here

    P.S. Check https://github.com/forcedotcom/postman-salesforce-apis out. It's bit more work to set the environment variables up, create an account with Postman to fork the repository... But in the long run saves reading documentation and typing all calls by hand.