tibemsConnectionFactory_SetOAuth2TokenFetchCallback

Function

Purpose

Set a callback that will be invoked whenever a connection needs to acquire an OAuth 2.0 access token.

C Declaration

tibems_status tibemsConnectionFactory_SetOAuth2TokenFetchCallback(
    tibemsConnectionFactory factory,
    tibemsOAuth2TokenFetchCallback callback );

IBM Systems

This function is not supported in COBOL, and on z/OS and IBM i systems.

Parameters

Parameter Description
factory Set the OAuth 2.0 access token fetch callback of this connection factory.
callback Use this callback function to obtain OAuth 2.0 access tokens.

Remarks

A connection factory can be configured to create connections capable of directly contacting an OAuth 2.0 provider and requesting OAuth 2.0 access tokens. If you wish to instead procure access tokens via an external mechanism and provide them directly to your connections, you can use this function to set a callback that will be invoked whenever an access token is required.

If a callback is set in a connection factory via this function, connections created using the factory will never attempt to request access tokens from an OAuth 2.0 authorization server using an OAuth 2.0 grant – even if the relevant OAuth 2.0 parameters were set in the factory through the client API or environment variables.

Note: If a connection factory is configured with both an access token and a user-defined callback, connections created using the factory will always use the access token for authentication. See tibemsOAuth2Params_SetAccessToken for details.

See Also

tibemsOAuth2TokenFetchCallback