Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mv_registerclient.sas File Reference

Register Client and Secret (admin task) More...

Go to the source code of this file.

Detailed Description

When building apps on SAS Viya, an client id and secret is required. This macro will obtain the Consul Token and use that to call the Web Service.

more info: https://developer.sas.com/reference/auth/#register and: http://proc-x.com/2019/01/authentication-to-sas-viya-a-couple-of-approaches/

The default viyaroot location is /opt/sas/viya/config

Usage:

%* compile macros;
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

%* specific client with just openid scope;
%mv_registerclient(client_id=YourClient
  ,client_secret=YourSecret
  ,scopes=openid
)

%* generate random client details with all scopes;
%mv_registerclient(scopes=openid *)

%* generate random client with 90/180 second access/refresh token expiry;
%mv_registerclient(scopes=openid *
  ,access_token_validity=90
  ,refresh_token_validity=180
)
Parameters
client_id=The client name. Auto generated if blank.
client_secret=Client secret Auto generated if client is blank.
scopes=list of space-seperated unquoted scopes (default is openid)
grant_type=valid values are "password" or "authorization_code" (unquoted)
outds=the dataset to contain the registered client id and secret
access_token_validity=The duration of validity of the access token in seconds. A value of DEFAULT will omit the entry (and use system default)
refresh_token_validity=The duration of validity of the refresh token in seconds. A value of DEFAULT will omit the entry (and use system default)
name=A human readable name for the client
required_user_groups=A list of group names. If a user does not belong to all the required groups, the user will not be authenticated and no tokens are issued to this client for that user. If this field is not specified, authentication and token issuance proceeds normally.
autoapprove=During the auth step the user can choose which scope to apply. Setting this to true will autoapprove all the client scopes.
use_session=If true, access tokens issued to this client will be associated with an HTTP session and revoked upon logout or time-out.
outjson=A dataset containing the lines of JSON submitted. Useful for debugging. Default= null.
Version
VIYA V.03.04
Author
Allan Bowe @source https://github.com/sasjs/core

Dependencies

Definition in file mv_registerclient.sas.