1

I checked similar error post but couldn't resolve my issue.

I am able to run successfully https://xxxxx.lightning.force.com/services/data from postman using generated access_token but not able to run https://xxxxx.lightning.force.com/services/data/v56.0 or any version before that with the same access_token. enter image description here

enter image description here

SMehta
  • 11
  • 1
  • get both the access token and the refresh token then use the refresh token to get a new access token. this is how to prevent session time out errors – Golden Lion Oct 10 '22 at 14:26

1 Answers1

1

No.

You don't need access token to use https://xxxxx.my.salesforce.com/services/data. You can view it in your browser without any fancy headers, even in incognito window. I don't need to be a British Airways / Heathrow employe to see https://baa.my.salesforce.com/services/data or even any generic https://eu32.my.salesforce.com/services/data.

This is the real start url. You know nothing about the org, you don't know which API versions it supports - here's a list. It can't be protected by login screen.


I don't think you did it right. Your second screenshot contains "lightning.force.com", I'd expect "my.salesforce.com". Maybe API v 56 is not in that org yet. But for sure the url is wrong, you're supposed to use instance_url from successful login response. See https://stackoverflow.com/a/68190644/313628 and screenshot in https://stackoverflow.com/a/73873644/313628. You can't take only the session id (access_token)

And yes, sessions expire, anything between 15 min and 12h. What you can do next depends on how you got this access_token (some flows like "username password flow" don't generate refresh_token). Log in again or use refresh token to get new session id.

eyescream
  • 18,088
  • 2
  • 34
  • 46
  • 1
    Thank you very much pointing me to the right direction. I was using url that I was using to get access_token for accessing resources under latest version. But after replacing url with the once I received in instance_url, it worked fine. Thank you very much. – SMehta Oct 12 '22 at 13:29
  • Glad I could help. It's very important to use what you get back in login response. If you hardcode production url and think it won't change - critical updates like "enhanced domains" will break your integration. – eyescream Oct 13 '22 at 08:00