Sync authentication tokens every 5 minutes

Recipe ToolsMarketingDeveloper ToolAPI Integration

What it does

When the clock triggers every 5 minutes, this automation exchanges credentials for fresh authentication tokens via two HTTP requests. It logs each result to a job report so someone can verify the sync succeeded.

Who it's for

IT teams who need to maintain token synchronization on a regular schedule without manual intervention.

How teams use this

Keep tokens fresh automatically

Exchange credentials every 5 minutes without manual intervention so tokens stay valid and integrations remain connected. The schedule ensures no gaps in authentication availability.

Monitor token sync in a dashboard

Log each token exchange to a job report that feeds into a monitoring dashboard so someone can see sync health at a glance. Only the logging destination changes.

Add conditional retry on exchange failure

Include a condition to check if part 1 or part 2 fails, then retry the failed HTTP request once before logging. This requires adding error handling logic to the requests.

Notify security on sync failures

Set up a notification to alert the security team when either HTTP request fails or returns an error. This requires adding a notification step after the logging step.

How it works

  1. Start on a 5-minute schedule. The automation begins every 5 minutes to keep authentication tokens current and valid for integrations.
  2. Exchange credentials for tokens part 1. Send the first HTTP request with client ID, user ID, token URL, private key, grant type, and company ID to initiate token exchange.
  3. Complete token exchange part 2. Send the second HTTP request to finish the token refresh cycle and obtain the new authentication credentials.
  4. Log results to job report. Record both HTTP requests and their outcomes in the job report for audit trails and troubleshooting reference.