<?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: /SASLogon/oauth/token: Invalid token (approvals expired) in Developers</title>
    <link>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/630026#M662</link>
    <description>&lt;P&gt;I tried it again today, and it worked.&amp;nbsp; Must have been a critter in a circuitboard somewhere &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Mar 2020 09:06:27 GMT</pubDate>
    <dc:creator>AllanBowe</dc:creator>
    <dc:date>2020-03-06T09:06:27Z</dc:date>
    <item>
      <title>/SASLogon/oauth/token: Invalid token (approvals expired)</title>
      <link>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/629849#M660</link>
      <description>&lt;P&gt;I'm running the following code as part of the &lt;A href="https://github.com/macropeople/macrocore/blob/master/viya/mv_registerclient.sas" target="_self"&gt;mv_registerclient&lt;/A&gt; macro for creating web services as described &lt;A href="https://sasjs.io/quickstart/services/#viya" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc http method='POST'
in="grant_type=refresh_token&amp;amp;refresh_token=&amp;amp;REFRESH_TOKEN" out=&amp;amp;FILEREF
url='localhost/SASLogon/oauth/token' WEBUSERNAME="&amp;amp;CLIENT_ID" WEBPASSWORD="&amp;amp;CLIENT_SECRET" AUTH_BASIC;
headers "Accept"="application/json" "Content-Type"="application/x-www-form-urlencoded";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;This code has &lt;STRONG&gt;worked perfectly&lt;/STRONG&gt;&amp;nbsp;for at least 6 months, in a number of different Viya environments.&amp;nbsp; However today it threw:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{"error":"invalid_token","error_description":"Invalid token (approvals expired)"}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I generate a new client_id and client_secret every time I run the code, as I'm mainly doing demos or working with fresh installs.&amp;nbsp; What could be the issue?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2020 00:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/629849#M660</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-06-05T00:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: /SASLogon/oauth/token: Invalid token (approvals expired)</title>
      <link>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/629854#M661</link>
      <description>&lt;P&gt;Hi Allan /&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/28909"&gt;@AllanBowe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting. As you might know, the token in an OAuth2 kind of token, therefore, it can be printed as JSON . Have you tried that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reason for me asking is because it is relatively common and well known:&amp;nbsp;&lt;A href="https://www.oauth.com/oauth2-servers/making-authenticated-requests/refreshing-an-access-token/" target="_blank"&gt;https://www.oauth.com/oauth2-servers/making-authenticated-requests/refreshing-an-access-token/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This can help you to get better control on token expiration mechanics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other possibility that comes to my mind is that there is a deeper issue in that system, which could invalidate tokens unexpectedly. For this is harder to provide guidance, as it could be given by time zone change, time change, updates (OS and/or SAS), etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nonetheless, curl is your friend &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; As thumb rule: "Take things out of SAS, validate, then bring them back to SAS". Remove variables from the equation, then look at the logs.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 16:05:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/629854#M661</guid>
      <dc:creator>JuanS_OCS</dc:creator>
      <dc:date>2020-03-05T16:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: /SASLogon/oauth/token: Invalid token (approvals expired)</title>
      <link>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/630026#M662</link>
      <description>&lt;P&gt;I tried it again today, and it worked.&amp;nbsp; Must have been a critter in a circuitboard somewhere &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 09:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/630026#M662</guid>
      <dc:creator>AllanBowe</dc:creator>
      <dc:date>2020-03-06T09:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: /SASLogon/oauth/token: Invalid token (approvals expired)</title>
      <link>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/630028#M663</link>
      <description>&lt;P&gt;Oh, the story of our life &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great to hear!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You did well, not feeding him after midnight&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="0cf3776569094b5c73316999deec80a9" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36634i8B2C268A4D288414/image-size/medium?v=v2&amp;amp;px=400" role="button" title="0cf3776569094b5c73316999deec80a9" alt="0cf3776569094b5c73316999deec80a9" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 09:16:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SASLogon-oauth-token-Invalid-token-approvals-expired/m-p/630028#M663</guid>
      <dc:creator>JuanS_OCS</dc:creator>
      <dc:date>2020-03-06T09:16:39Z</dc:date>
    </item>
  </channel>
</rss>

