javascriptsalesforceintegrationsalesforce-lightning

Salesforce Integration INVALID_SESSION_ID using Postman


When hitting https://login.salesforce.com/services/oauth2/token, using Postman.

POST https://login.salesforce.com/services/oauth2/token

enter image description here

Response:

enter image description here

I receive a token, but when I try to do something as simple as GET /limits,

GET https://na73.salesforce.com/services/data/v45.0/limits

enter image description here

the response is:

[
    {
        "message": "Session expired or invalid",
        "errorCode": "INVALID_SESSION_ID"
    }
]

The strange thing is that when I change all my credentials to a free "developer account" created with a different email address, everything works fine. All requests and headers are the exact same, with the exception of the values from either account.

After digging through a lot of threads on here I thought that maybe my production account (the one I'm posting from now) was not API ENABLED. It turns out my production account is API ENABLED.

I also tried changing https://login.salesforce.com/services/oauth2/token to https://na73.salesforce.com/services/oauth2/token as some threads have suggested, but that just times out.

When comparing both account permissions, they seem identical and I've confirmed I have no issues with the credentials (client id, client secret, security token, access-token), all of them seem to be copied in correctly.

Any ideas for a salesforce noob?


Solution

  • I actually fixed this after banging my head on it forever. You need to go into the settings tab and turn on the Follow Authorization Header setting.

    Follow Authorization Header Setting