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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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