Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
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, a client id and secret are usually required. In order to generate them, the Consul Token is required. To access this token, you need to be a system administrator (it is not enough to be in the SASAdministrator group in SAS Environment Manager).

If you are registering a lot of clients / secrets, you may find it more convenient to use the [Viya Token Generator] (https://sasjs.io/apps/#viya-client-token-generator) (a SASjs Web App to automate the generation of clients & secrets with various settings).

For further information on clients / secrets, see;

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;

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

%* generate random client using consul token as input parameter;
%mv_registerclient(consul_token=12x34sa43v2345n234lasd)

%* specific client with just openid scope;
%mv_registerclient(client_id=YourClient
  ,client_secret=YourSecret
  ,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
[in,out]client_id=The client name. Auto generated if blank.
[in,out]client_secret=Client secret. Auto generated if client is blank.
[in]consul_token=(0) Provide the actual consul token value here if using Viya 4 or above.
[in]scopes=(openid) List of space-seperated unquoted scopes
[in]grant_type=(authorization_code|refresh_token) Valid values are "password" or "authorization_code" (unquoted). Pipe seperated.
[out]outds=(mv_registerclient)The dataset to contain the registered client id and secret
[in]access_token_validity=(DEFAULT) The access token duration in seconds. A value of DEFAULT will omit the entry (and use system default)
[in]refresh_token_validity=(DEFAULT) The duration of validity of the refresh token in seconds. A value of DEFAULT will omit the entry (and use system default)
[in]client_name=(DEFAULT) An optional, human readable name for the client.
[in]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.
[in]autoapprove=During the auth step the user can choose which scope to apply. Setting this to true will autoapprove all the client scopes.
[in]use_session=If true, access tokens issued to this client will be associated with an HTTP session and revoked upon logout or time-out.
[out]outjson=(null) A dataset containing the lines of JSON submitted. Useful for debugging.
Version
VIYA V.03.04
Author
Allan Bowe, source: https://github.com/sasjs/core

SAS Macros

Definition in file mv_registerclient.sas.