Need guidance on updating the email account table for automatic OAuth token refresh via Slack integr

Sathwik1
Tera Expert

I’m currently working on setting up OAuth authentication with automatic token renewal using the scheduled job “Refresh Email Access Token.”

 

From my understanding, this scheduled job requires a corresponding record in the Email Account table in order to run successfully. Since we also have Slack integration in place, could someone please clarify what specific fields or details need to be populated in the Email Account table to ensure that access tokens are refreshed automatically?

 

Additionally, are there any extra steps, configuration requirements, or best practices I should be aware of to ensure this setup works reliably?

 

and also I here that, if we use OOB Spoke, then servicenow only updates it automatically.. here we are use OOB Spoke for slack.. so is it expected to work?

 

@Ankur Bawiskar 

17 REPLIES 17

The confusion I think is coming from the email-specific nature of that scheduled job.

The Refresh Email Access Token job is only for OAuth based email integrations O365, Gmail....That’s why it looks for a record in the Email Account table. That table is strictly for mailboxes and email processing not for general integrations.

So to answer your questions directly:

  • You should not add anything to the Email Account table for Slack.

  • That job will never refresh Slack tokens, even if you populate the table.

  • It is expected that your Slack integration has no entry there.

For Slack Spoke everything OAuth-related lives in the Connection / Credential / OAuth token records created when you did Configure and Get OAuth Token. Thats the only place ServiceNow looks for Slack tokens really.

Adding offline_access is the right next step. Just remember:

  • After adding the scope, you must re-authorizeso Slack actually issues a refresh token.

  • If Slack issues one youll then see it stored alongside the access token.

  • From that point on ServiceNow usually refreshes the token on demand when the flow runs.

There is no separate OOB scheduled job for refreshing Slack tokens like there is for email. If auto-refresh doesn’t happen for some reason the fallback is a custom scheduled flow or script to refresh the token but many environments don’t need that once refresh tokens are present.

So to put in a nutshell:

  • Email Account table → email only

  • Email refresh job → emaill only

  • Slack Spoke → uses its own OAuth records

  • Offline access + re-auth  → required to get a refresh token

Your on the correct path from what your telling me and what we have troubleshoot. The key is just not to mix the email OAuth model with the Slack one they’re handled very differently by the platform.

 

@Sathwik1  - Please mark Accepted Solution and Thumbs Up if you find Helpful!!

MJG

Sathwik1
Tera Expert

@VaishnaviK16371 can you help to look into this?

Sathwik1
Tera Expert