BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AllanBowe
Barite | Level 11

I'm running the following code as part of the mv_registerclient macro for creating web services as described here.

 

proc http method='POST'
in="grant_type=refresh_token&refresh_token=&REFRESH_TOKEN" out=&FILEREF
url='localhost/SASLogon/oauth/token' WEBUSERNAME="&CLIENT_ID" WEBPASSWORD="&CLIENT_SECRET" AUTH_BASIC;
headers "Accept"="application/json" "Content-Type"="application/x-www-form-urlencoded";
run;

This code has worked perfectly for at least 6 months, in a number of different Viya environments.  However today it threw:

 

{"error":"invalid_token","error_description":"Invalid token (approvals expired)"}

 

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.  What could be the issue?

 

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
1 ACCEPTED SOLUTION

Accepted Solutions
JuanS_OCS
Amethyst | Level 16

Oh, the story of our life 🙂

 

Great to hear!

 

You did well, not feeding him after midnight

 

 

0cf3776569094b5c73316999deec80a9

 

View solution in original post

3 REPLIES 3
JuanS_OCS
Amethyst | Level 16

Hi Allan / @AllanBowe 

 

Interesting. As you might know, the token in an OAuth2 kind of token, therefore, it can be printed as JSON . Have you tried that?

 

Reason for me asking is because it is relatively common and well known: https://www.oauth.com/oauth2-servers/making-authenticated-requests/refreshing-an-access-token/

This can help you to get better control on token expiration mechanics.

 

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.

 

Nonetheless, curl is your friend 🙂 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.

AllanBowe
Barite | Level 11

I tried it again today, and it worked.  Must have been a critter in a circuitboard somewhere 🙂

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
JuanS_OCS
Amethyst | Level 16

Oh, the story of our life 🙂

 

Great to hear!

 

You did well, not feeding him after midnight

 

 

0cf3776569094b5c73316999deec80a9

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1620 views
  • 3 likes
  • 2 in conversation