function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venu SamVenu Sam 

Session expired/invalid or INVALID_SESSION_ID error when trying to get access token through oAuth2 token?

Hi All,

When trying to get access token through from an app hosted on heroku unable to get access token.

Error seen in logs:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]

Params for Post Request:

When I hit through postman with same params I am able to get access token.

Approaches tried:

1. We have whitelisted all IP's
2. We have generated new client id and secret.
3. Hit the Same Url through the same parameters received the token.

4. Set Permitted Users to All users may self-authorize .

5.Relaxed IP restrictions.

Please help me in resolving this issue.

P.S: All the help available in Forum are related to and doesn't help in my case.


Did you try the domain url? instead of can you try domain name 
Venu SamVenu Sam

Hi Simmy,

Thanks for the response.

Yes, I have tried usign the domain it doesn't help either.

Getting the sam error.

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


Paul ZonisPaul Zonis
By any chance is it when you're trying to connect to the opportunity object? The reason I ask is I am encountering the same problem and was able to pinpoint it down to the opportunity object. 
Venu SamVenu Sam

No Paul,

It is when I try to authenticate from heroku app.