tibemsOAuth2TokenFetchCallbackEx
Type
Purpose
Obtain an OAuth 2.0 access token to be used for authenticating with the EMS server during connection establishment.
C Declaration
typedef tibems_status (*tibemsOAuth2TokenFetchCallbackEx) ( char** accessToken, tibemsConnection connection, void* closure);
IBM Systems
This type is not supported on z/OS and IBM i systems.
Parameters
Parameter | Description |
---|---|
accessToken |
The callback must store the OAuth 2.0 access token in this variable. |
connection |
The connection object that requires the OAuth 2.0 access token. |
closure |
Receive the closure data, which the program supplied in the call to tibemsOAuth2Params_SetTokenFetchCallback. |
Remarks
To use OAuth 2.0 access tokens obtained via an external mechanism, your program can define callbacks of this type and register them with connection factories via OAuth 2.0 parameters objects (See tibemsOAuth2Params_SetTokenFetchCallback
and tibemsConnectionFactory_SetOAuth2Params
). Connections created using a particular connection factory will use the corresponding callback to obtain access tokens for authenticating with the EMS server.
The accessToken
parameter serves as an in-out-parameter. The callbacks must store the access token in this variable in order for the token to be made available to the connection object. Memory allocated for accessToken
by the callbacks will automatically be freed by the connection object once the authentication attempt is complete.
If a valid access token was obtained and stored in accessToken
, the callbacks should indicate success by returning a tibems_status
value of TIBEMS_OK
. If a valid access token could not be obtained, an appropriate tibems_status
value should be returned to indicate failure.
Deprecated Form
typedef tibems_status (*tibemsOAuth2TokenFetchCallback) ( char** accessToken, tibemsConnection connection );
tibemsOAuth2TokenFetchCallback
as well as a callback of type tibemsOAuth2TokenFetchCallbackEx
, connections created using that factory will only use the callback of deprecated type tibemsOAuth2TokenFetchCallback
to obtain access token.