OAuthAPI.FetchOpenIDMetadata

Fetch metadata from the Identity Provider at the URL provided.

Syntax

FetchOpenIDMetadata(
   timeout INTEGER, 
   idp STRING )
RETURNS OAuthAPI.OpenIDMetadataType
  1. timeout defines the number of seconds.
  2. idp is the URL of the Identity Provider (IdP).

NULL may be returned if metadata is not found.

Usage

Use this function to retrieve the metadata (such as registration endpoint, supported scopes, user information endpoints, and son on) provided by the Identity Provider for access to a secure RESTful web service. The information is retrieved in a requested to the IdP via the URL provided and stored in the OpenIDMetadataType record.

If the service is started behind the GAS, call the GetOpenIDMetadata() function instead.

In case of error, a NULL value will be returned.

OAuthAPI.FetchOpenIDMetadata function

IMPORT FGL OAuthAPI

PRIVATE DEFINE metadata OAuthAPI.OpenIDMetadataType
DEFINE idp_url STRING 

MAIN
  # ...
     CALL OAuthAPI.FetchOpenIDMetadata(20, idp_url)
          RETURNING metadata.*
     IF metadata.issuer IS NULL THEN
         ERROR "IdP not available"
     ELSE
       DISPLAY "Registration endpoint is:", metadata.registration_endpoint
     END IF
  # ... 
  
END MAIN