<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Job started using client ID authcode starts then fails in SAS Viya</title>
    <link>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972539#M2957</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/476758"&gt;@Malux&lt;/a&gt;&amp;nbsp;, how are you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your description, it seems that the job execution is being triggered before the SAS authentication is fully established. As a result, the first attempt fails, but when you retry (now with an active authenticated session), it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’d suggest adding a short wait (around 10 seconds) after obtaining the token and before executing the job. This should give enough time for the authentication to be fully recognized by SAS before the job starts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Tue, 12 Aug 2025 22:02:54 GMT</pubDate>
    <dc:creator>arthurdpereira</dc:creator>
    <dc:date>2025-08-12T22:02:54Z</dc:date>
    <item>
      <title>Job started using client ID authcode starts then fails</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972522#M2956</link>
      <description>&lt;P&gt;I am trying to execute a sas via 3.5 job using a client id and secret. &amp;nbsp;I can see the job start successfully using the authenticated user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, while the job starts, it fails shortly after with the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;The SAS program provided for the job completed execution with at least one error.
500 : ""errorCode":30029,"message":"Failed to launch process.","details":["traceId: 916dbe177de581e0","path: /launcher/processes","path: /compute/contexts/3466208e-7633-48cd-9073-c2d47394c868/sessions"],"errors":["errorCode":30013,"message":"Failed to launch process: host=&amp;lt;HOST&amp;gt; port=44743 ssl=true","links":[],"version":2,"httpStatusCode":0,"errorCode":30012,"message":"Server error: status=0x80BFD100 messages=[ERROR: Access denied.]","links":[],"version":2,"httpStatusCode":0],"links":[],"version":2,"httpStatusCode":500"&lt;/PRE&gt;&lt;P&gt;Note: I hid the server name for security.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If, however, I restart the job from the environment manager by right-clicking and clicking "Execute" the job completes successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Failure:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Malux_2-1755019692878.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108980i5EDDFE33C1F569EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Malux_2-1755019692878.png" alt="Malux_2-1755019692878.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Success after retry:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Malux_3-1755019806383.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108981iCADF3DD4D641C112/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Malux_3-1755019806383.png" alt="Malux_3-1755019806383.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick note: I need to hide the user name for security. &amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Below is how I am creating the client_id:&lt;/P&gt;&lt;PRE&gt; curl -k -X POST "&amp;lt;SERVER&amp;gt;/SASLogon/oauth/clients" \
  -H "Authorization: Bearer $BEARER" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "&amp;lt;USER&amp;gt;",
    "client_secret": "&amp;lt;SECRET&amp;gt;",
    "authorities": ["openid","uaa.user", "uaa.resource","sasapp", "sastoken","jobExecution", "session", "compute", "jobExecution.launch","job","files","casManagement","data","identity","read","write","execute","sas.jobs","sas.compute","sas.files","sas.identities","sas.data","sas.read","compute","audit","admin","authorization","credentials","jobDefinition"],
    "scopes": ["openid","uaa.user", "uaa.resource","sasapp", "sastoken","jobExecution", "session", "compute", "jobExecution.launch","job","files","casManagement","data","identity","read","write","execute","sas.jobs","sas.compute","sas.files","sas.identities","sas.data","sas.read","compute","audit","admin","authorization","credentials","jobDefinition"],
    "authorized_grant_types": ["authorization_code","client_credentials","refresh_token"],
    "redirect_uri": ["http://localhost:5000/oauth/callback"],
    "autoapprove": true
  }'&lt;/PRE&gt;&lt;P&gt;Note: user, server and secret have been obfuscated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here's how the login is happening after getting the auth code:&lt;/P&gt;&lt;PRE&gt;curl -k &amp;lt;SERVER&amp;gt;/SASLogon/oauth/token \
     -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" \
     -u "&amp;lt;USER&amp;gt;:&amp;lt;SECRET&amp;gt;" \
     -d "grant_type=authorization_code&amp;amp;code=&amp;lt;CODE&amp;gt;"&lt;/PRE&gt;&lt;P&gt;here's how the job is launched:&lt;/P&gt;&lt;PRE&gt;curl -X POST "&amp;lt;SERVER&amp;gt;/jobExecution/jobs" \
  -H "Authorization: Bearer $BEARER" \
  -H "Content-Type: application/json" \
  -d '{
        "jobDefinitionUri": "/jobDefinitions/definitions/&amp;lt;URI&amp;gt;"
      }'&lt;/PRE&gt;&lt;P&gt;I've also tried specifying the compute context. &amp;nbsp;all to no avail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Keep in mind: I do get a response showing the job started, but it fails immediately after launch.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Aug 2025 17:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972522#M2956</guid>
      <dc:creator>Malux</dc:creator>
      <dc:date>2025-08-12T17:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Job started using client ID authcode starts then fails</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972539#M2957</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/476758"&gt;@Malux&lt;/a&gt;&amp;nbsp;, how are you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your description, it seems that the job execution is being triggered before the SAS authentication is fully established. As a result, the first attempt fails, but when you retry (now with an active authenticated session), it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’d suggest adding a short wait (around 10 seconds) after obtaining the token and before executing the job. This should give enough time for the authentication to be fully recognized by SAS before the job starts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Aug 2025 22:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972539#M2957</guid>
      <dc:creator>arthurdpereira</dc:creator>
      <dc:date>2025-08-12T22:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Job started using client ID authcode starts then fails</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972565#M2959</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/443120"&gt;@arthurdpereira&lt;/a&gt;&amp;nbsp;I'm not sure it's that. &amp;nbsp;it looks like I can't establish a session&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;curl -k -X POST \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;"&amp;lt;SERVER&amp;gt;/compute/contexts/&amp;lt;CONTEXT/sessions" \&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-H "Authorization: Bearer $BEARER" \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-H "Content-Type: application/json" \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-d '{}'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the above returns:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ErrorResponse[version=2,status=500,err=30029,id=&amp;lt;null&amp;gt;,message=Failed to launch process.,detail=[traceId: f7d207e6db5f2611, path: /launcher/processes, path: /compute/contexts/&amp;lt;CONTEXT&amp;gt;/sessions],remediation=&amp;lt;null&amp;gt;,targetUri=&amp;lt;null&amp;gt;,errors=[ErrorResponse[version=2,status=0,err=30013,id=&amp;lt;null&amp;gt;,message=Failed to launch process: host=&amp;lt;HOST&amp;gt; ssl=true,detail=&amp;lt;null&amp;gt;,remediation=&amp;lt;null&amp;gt;,targetUri=&amp;lt;null&amp;gt;,errors=&amp;lt;null&amp;gt;,links=[]], ErrorResponse[version=2,status=0,err=30012,id=&amp;lt;null&amp;gt;,message=Server error: status=0x80BFD100 messages=[ERROR: Access denied.],detail=&amp;lt;null&amp;gt;,remediation=&amp;lt;null&amp;gt;,targetUri=&amp;lt;null&amp;gt;,errors=&amp;lt;null&amp;gt;,links=[]]],links=[]]&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Aug 2025 14:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972565#M2959</guid>
      <dc:creator>Malux</dc:creator>
      <dc:date>2025-08-13T14:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Job started using client ID authcode starts then fails</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972568#M2960</link>
      <description>You appear to be successfully authenticating to Viya using an authorization code, so your REST API request to run the job is successful. This triggers a request from job-execution to compute to run the code. To do so, compute attempts to start a compute server through a request to the launcher service, which would submit the attempt to the launcher server.&lt;BR /&gt;The "Access Denied" error is coming from the launcher server when authenticating against the host.&lt;BR /&gt;If you store a valid user ID and password to launch the process on the compute server host for your identity under Environment Manager &amp;gt; My Credentials in the DefaultAuth domain, is the launch successful?</description>
      <pubDate>Wed, 13 Aug 2025 15:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972568#M2960</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2025-08-13T15:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Job started using client ID authcode starts then fails</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972598#M2964</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78975" target="_blank"&gt;@gwootton&lt;/A&gt;&amp;nbsp;YES! &amp;nbsp;the launch is successful if I enter my user credentials there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curiously the job execution works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;curl -X POST "&amp;lt;SERVER&amp;gt;/jobExecution/jobs" \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-H "Authorization: Bearer $BEARER" \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-H "Content-Type: application/json" \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-d '{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;"jobDefinitionUri": "/jobDefinitions/definitions/&amp;lt;URI&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BUT...creating a session gives me a 401 now not a 500 now&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;curl -X POST \ &lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;"&amp;lt;SERVER&amp;gt;/compute/contexts/&amp;lt;CONTEXT&amp;gt;/sessions" \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-H "Authorization: Bearer $BEARER" \&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-H "Content-Type: application/json" \&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &lt;/SPAN&gt;-d '{}' &lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ErrorResponse[version=2,status=401,err=401,id=HTTP_401,message=HTTP/1.1 401 Unauthorized,detail=[path: /compute/contexts/&amp;lt;CONTEXT&amp;gt;/sessions, traceId: 4296d285b1cc8cba],remediation=,targetUri=&amp;lt;null&amp;gt;,errors=[],links=[]]&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;%&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; &lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;also: I can't seem to get anything from _webout files...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 01:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972598#M2964</guid>
      <dc:creator>Malux</dc:creator>
      <dc:date>2025-08-14T01:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Job started using client ID authcode starts then fails</title>
      <link>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972624#M2965</link>
      <description>A 401 unauthorized response usually suggests an issue with the token you're using (whereas 403 forbidden means you have a permissions issue). You may need to get a fresh token.&lt;BR /&gt;&lt;BR /&gt;For the _webout issue you might want to check _omitSessionResults is set to false.&lt;BR /&gt;&lt;BR /&gt;Control When the Compute Provider Saves Results&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/sasadmincdc/v_064/caljobs/p1xrrmzo4afphbn1pn3j9hqfd5rv.htm#n1sda1twhq33ytn1sqslo2oc33lu" target="_blank"&gt;https://go.documentation.sas.com/doc/en/sasadmincdc/v_064/caljobs/p1xrrmzo4afphbn1pn3j9hqfd5rv.htm#n1sda1twhq33ytn1sqslo2oc33lu&lt;/A&gt;</description>
      <pubDate>Thu, 14 Aug 2025 15:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/Job-started-using-client-ID-authcode-starts-then-fails/m-p/972624#M2965</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2025-08-14T15:19:03Z</dc:date>
    </item>
  </channel>
</rss>

