Session expiry issue in Salesforce CRM integration

Niharika Raj
Kilo Guru

Hi,

We have implemented Salesforce CRM integration in our instance based on the docs: https://docs.servicenow.com/bundle/rome-it-asset-management/page/product/software-asset-management2/concept/integrate-with-salesforce-crm.html.

We have set the default grant type as 'Resource owner Password credentials' as credentials were shared by the Salesforce team. As specified in the docs link, we were able to click on the 'Get OAuth token' link and retrieve the access token using the username and password+security_token combo. Salesforce team has set the security token lifespan to 6 months.
The job ran successfully that day, however, in the next schedule (the next day), it  failed with the error: Response Received: {"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}.

We tried the below options to fix this:
1. Increased access token lifespan in application registry to 6 months
2. Increased the expiry date in OAuth credentials to 6 months

However, all of the above options didn't work and we had to click on the 'Get OAuth token' link again and had to re-enter the same credentials and only then the job worked.
This is of course, not an ideal way to setup the integration.

Is there a way to fix this issue? Any help would be appreciated.

Regards,

Niharika Raj

1 ACCEPTED SOLUTION

Niharika Raj
Kilo Guru

Hello Patrick,

 

Thanks for the reply. I know this is a very late update, but I just wanted to help anyone who was facing the same issue.

We requested the Salesforce team to reset the credentials, updated the grant type to 'Authorization code' and tried again.

This worked for us and we didn't encounter the session timeout issue.

 

Thanks!

Niharika Raj

View solution in original post

5 REPLIES 5

PatrickLowndes
ServiceNow Employee
ServiceNow Employee

Hi Niharika,

This is something you should submit a case for. Our support team will help, as it's likely something related to your ServiceNow instance or unique internal environment around OAuth.

 

Niharika Raj
Kilo Guru

Hello Patrick,

 

Thanks for the reply. I know this is a very late update, but I just wanted to help anyone who was facing the same issue.

We requested the Salesforce team to reset the credentials, updated the grant type to 'Authorization code' and tried again.

This worked for us and we didn't encounter the session timeout issue.

 

Thanks!

Niharika Raj

We got I guess same problem.

token to salesforce in servicenow is valid till 11/2024

now and then we lose access and I have to get Oauth token manually with user id/password.

 

I will try to ask Salesforce for what you suggested.

 

Dis it solves issue for you or did you face same issue again?

Hi Petr,

 

We didn't encounter the issue again.