You need to sign in to do that
Don't have an account?
Ajinkya Pande 10
Getting this error Invalid Session Id
I am getting this error while using Developer Sandbox: invalid session id this gets resolved when the security token is reset and need to use the new credentials for API users.
Check steps mentioned below for error INVALID_SESSION_ID.
https://help.salesforce.com/s/articleView?id=000335524&type=1
Please mark as Best Answer if above information was helpful.
Thanks,
All Answers
Check steps mentioned below for error INVALID_SESSION_ID.
https://help.salesforce.com/s/articleView?id=000335524&type=1
Please mark as Best Answer if above information was helpful.
Thanks,
Hi,
Out of intersest did this code work before the Winter '22 release?
Seeing some perfectly functioning code that calls an Apex API has suddenly stopped working and it's rejecting the token with this error.
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
I'm still investigating why - I suspect IP restrictions / user restrictions are being enforced now. Obvioulsy need to work this out before this rolls to production instances.
Steve
OK - worked it out.
I think it's the Enhanced Domains setting for our UAT site. The URLs for the API endpoints now have .sandbox. included. Salesforce have added a 307 redirect on the old apoi but though the auth token is posted on the initial request it's not present for SF on the redirect.
https://help.salesforce.com/s/articleView?id=release-notes.rn_security_domains_enhanced_ru.htm&type=5&release=240
So the fix my side was to update all URLs for external API calls from:
https://CLIENT--uat.my.salesforce.com/services/apexrest/myapiname/v1
TO:
https://CLIENT--uat.sandbox.my.salesforce.com/apexrest/myapiname/v1
Hopefully this also means production will be unaffected but I shall definitely be reviewing.
I hope this helps someone else!
Steve