OAuthAPI APIs

The OAuthAPI library provides functions for working with OAuth.

Table 1. OAuthAPI functions
Function Name Description
Init( 
   cnx_timeout INTEGER, 
   client_id STRING,
   client_secret STRING )
  RETURNS BOOLEAN 
To be called in a Genero app accessing a secure RESTful Web service started behind a Genero Application Server.
InitService( 
   cnx_timeout INTEGER, 
   access_token STRING )
  RETURNS BOOLEAN 
To be called in a Genero Web service started via OpenID Connect accessing another secure RESTful Web service as a client.
GetOpenIDMetadata()
RETURNS OAuthAPI.OpenIDMetadataType
Get metadata from the Identity Provider for a service running on a Genero Application Server (GAS).
FetchOpenIDMetadata(
   timeout INTEGER, 
   idp STRING )
RETURNS OAuthAPI.OpenIDMetadataType
Fetch metadata from the Identity Provider at the URL provided.
GetIDPIssuer()
RETURNS STRING
Get endpoint of the Identity Provider.
GetIDSubject()
RETURNS STRING
Get OAuth subject identifier of ID Token.
GetIDScopes()
RETURNS DYNAMIC ARRAY OF STRING
Get OAuth ID Token authorization scopes.
ExtractTokenFromHTTPRequest(
req comm.HttpServiceRequest)
RETURNS STRING
Return the OAuth access token.
RetrieveServiceToken(
   timeout INTEGER,
   TokenServiceURL STRING, 
   client_id STRING, 
   secret_id STRING,
   scope STRING )
RETURNS STRING, INTEGER
Return the OAuth service access token via client app credentials.
RetrievePasswordToken(
   timeout INTEGER,
   TokenServiceURL STRING, 
   usr, STRING, 
   pass STRING,
   scope STRING )
RETURNS ( STRING, INTEGER )
Return the OAuth service access token via user name and password.
GetMyAccessToken()
RETURNS STRING
Get a valid access token.
CreateHTTPAuthorizationRequest(
   url STRING )
RETURNS com.HttpRequest
Create an HttpRequest with OAuth access token.
RetryHTTPRequest(
resp com.HttpResponse )
RETURNS BOOLEAN
Retry an HttpRequest with OAuth access token to check if the access token has expired.