Background jobs fail after running for approximately one hour with "You are not authorized to submit this request"


A SAS® Model Studio job fails with the following error after running in the background for approximately one hour:

You are not authorized to submit this request.

Note that the job runs successfully in SAS® Studio, and the job completes after running for more than two hours. The job also completes successfully when you subset the data that so it runs for less than one hour and execute it in the background. 

SAS Studio (Interactive)✅ Auto‑refresh via browser sessionLong jobs work
Background / Batch Job❌ No refresh mechanismFails after ~1 hour

Cause

An OAuth token expiration causes this issue. In SAS® Viya®, background jobs authenticate using an OAuth access token that SAS Logon issues.

Note that this issue does not involve a SAS Compute time-out and nor a Python error. The issue involves an authentication failure that happens mid‑job.

OAuth Token Information

Workaround

To circumvent this issue, complete any of the following workarounds:

Method 1 (Preferred): Run Long Jobs via the SAS Job Execution Service

SAS recommends this workaround for jobs that contain greater than one-hour workloads.

Instead of background compute jobs, expose the code as a job.


Method 2: Use a Service Account Token

If allowed by your security team, complete the following steps:

  1. Create a client credentials OAuth token.
  2. Authenticate SAS® Cloud Analytic Services using that token.

Note: You can issue tokens with longer lifetimes

This workaround avoids the user‑session expiry entirely.


Method 3: Split the Job into Stages

Checkpoint the pipeline:

  1. data prep
  2. supervised model
  3. anomaly model
  4. merge + promote

Each stage finishes in less than one hour. Then, hand off.


Method 4 (Not Recommended): Increase the Token Lifetime Globally

This workaround is possible, but note the following: