Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mv_tokenrefresh.sas File Reference

Get an additional access token using a refresh token. More...

Go to the source code of this file.

Detailed Description

Before an access token can be obtained, a refresh token is required For that, check out the mv_tokenauth macro.

Usage:

  prep work - register client, get refresh token, save it for later use ;
%mv_registerclient(outds=client)
%mv_tokenauth(inds=client,code=wKDZYTEPK6)
data _null_;
file "~/refresh.token";
put "&refresh_token";
run;

  now do the things n stuff;
data _null_;
  infile "~/refresh.token";
  input;
  call symputx('refresh_token',_infile_);
run;
%mv_tokenrefresh(client_id=&client
  ,client_secret=&secret
)

A great article for explaining all these steps is available here:

https://blogs.sas.com/content/sgf/2019/01/25/authentication-to-sas-viya/

Parameters
[in]inds=A dataset containing client_id and client_secret
[in]outds=A dataset containing access_token and refresh_token
[in]client_id=The client name (alternative to inds)
[in]client_secret=client secret (alternative to inds)
[in]grant_type=valid values are "password" or "authorization_code" (unquoted). The default is authorization_code.
[in]user=If grant_type=password then provide the username here
[in]pass=If grant_type=password then provide the password here
[in]access_token_var=(ACCESS_TOKEN) The global macro variable to contain the access token
[in]refresh_token_var=(REFRESH_TOKEN) The global macro variable containing the refresh token
Version
VIYA V.03.04
Author
Allan Bowe, source: https://github.com/sasjs/core

SAS Macros

Definition in file mv_tokenrefresh.sas.