OAuthAPI.init
To be called in a Genero app accessing a secure RESTful Web service started behind a Genero Application Server.
Syntax
Init(
cnx_timeout INTEGER,
client_id STRING,
client_secret STRING )
RETURNS BOOLEAN
- cnx_timeout is a connection timeout to the REST service with value in seconds.
- client_id is the application ID assigned to the app when registered.
- client_secret is the application secret created for the app.
Returns FALSE
if the mandatory access token is null.
Usage
Use this function to initiate information provided by the Identity Provider to access the secure RESTful Web service. It calls environment variables containing the OAuth information got from the Genero Identity Provider (GIP) or a third party Identity Provider (IdP). It registers the access token and access information (such as subject, scopes, endpoints, etc.) with the GWS engine.
In case of error, a NULL
value will be returned.
OAuthAPI.init function
IMPORT FGL OAuthAPI
DEFINE my_user_id STRING
MAIN
# ...
# Init OAuthAPI
IF NOT OAuthAPI.init(5, "AF350CBC-8801-4DFB-9A78-A95B25BB32AF", "8JEq3HBfxrmj/8vMP66iaRQnGrWVyjqr") THEN
DISPLAY "Error: unable to initialize OAuth"
EXIT PROGRAM 1
ELSE
LET my_user_id = OAuthAPI.getIDSubject
END IF
# ...
END MAIN