restforce: Restforce::UnauthorizedError: INVALID_SESSION_ID: Session expired or invalid

Hello,

I’m using the omniauth-saleforce gem to perform OAuth authentication between my app and my customers Salesforce instance. They can successfully authenticate and grant my app the token and refreshtoken, however after a period of time the session expires with the following message:

Restforce::UnauthorizedError: INVALID_SESSION_ID: Session expired or invalid

What am I doing wrong? Should I be requesting a new token via the existing connection?

Thanks!

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 1
  • Comments: 39 (1 by maintainers)

Most upvoted comments

For anyone else that’s getting bitten by this, I was getting the same INVALID_SESSION_ID error but only in the sandbox environment. I had incorrectly used “test.salesforce.com” as the host instead of the same domain name as the instance_url.

I’m a bozo. I forgot to add the refresh_token when I was initializing the Restforce instance. It appears to be working properly now.