Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

OAuth Token Expiring Every Hour – Not Refreshing Automatically in ServiceNow

dd31
Tera Guru

Hi team,

I have an integration set up between Microsoft 365 and ServiceNow where I created an Application Registry using client credentials.

Currently, I need to manually click the “Get OAuth Token” related link to generate the token. The token expires after about 1 hour, and once it expires the integration fails until I manually generate a new token again.

From my understanding, the token refresh should normally be handled automatically by ServiceNow.

Has anyone faced a similar issue where the OAuth token is not being refreshed automatically?
Is there any additional configuration required in the Application Registry or OAuth profile to enable automatic token refresh?

Any guidance would be appreciated.

 

Thanks!

3 REPLIES 3

Tanushree Maiti
Giga Sage

Hi @dd31 

 

Same thing we have faced. When we talked to Microsoft team 365 team , they said it is as per their policy and they will not change.

 

So you need to decide whether you will continue with 1 hour interval token generation  as platform performance wise it is not good.

 

But as we do not have any other workaround for our use cases, we have continued with this 1 hour interval token generation.

 

Hope it answers your question.

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

@Tanushree Maiti 

Thanks for the response. However, generating the token every hour manually is not a feasible approach for our use case.

We have SAM jobs running in ServiceNow that depend on this integration with Microsoft 365, and these jobs use the OAuth token to fetch usage data. If the token expires every hour and requires manual regeneration, it would require constant intervention, which is not practical.

Ideally, the token generation or refresh should be handled automatically so that the scheduled SAM jobs can run without any manual steps.

Hi @dd31 

 

Just sharing my exp if it helps.

 

Our use cases on SAM :using Direct integration profile we are pulling the data from O365 . Its kind of 180K+ data job runs at backend for 4 hours. 

(refer: https://www.google.com/search?sca_esv=d087776caa853f74&udm=7&fbs=ADc_l-aN0CWEZBOHjofHoaMMDiKpmAsnXCN... )

 

Among that count , 10 k data SAM team was not able to reconcile due toa specific reason.. so using this Oauth 2.0 set up  we are sending the request via flow  . Considering the data amt , we thought 1 hour is fine.

 

Same approach you can follow.

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: