Skip to main content

TdxOAuth2AuthorizationAgent.TReceiveAccessTokenEvent Type

The OAuth 2.0 access token acquisition event type.

Declaration

TReceiveAccessTokenEvent = procedure(Sender: TObject; out ATokenAccess: string; out ATokenRefresh: string; out ATokenType: string) of object;

Parameters

Name Type Description
Sender TObject

The OAuth 2.0-compatible authorization agent component that raised an access token acquisition event.

ATokenAccess string

The received access token.

ATokenRefresh string

The received refresh token.

ATokenType string

Returns the received token type (always ‘Bearer’ for OAuth 2.0 authentication servers).

Remarks

The access token acquisition event occurs immediatley prior to an attempt to receive an authorization code from an OAuth 2.0 authentication server and allows you to implement custom authentication an authorization routines for a TdxOAuth2AuthorizationAgent class descendant.

The Sender parameter provides access to the OAuth 2.0-compatible authorization agent component that raised the event. To access the authorization agent’s class members, cast the parameter value to the corresponding TdxOAuth2AuthorizationAgent class descendnat (TdxGoogleAPIOAuth2AuthorizationAgent, for instance). You can call the Sender.ClassName function to identify the actual authorization agent component type.

Use the ATokenAccess and ATokenRefresh parameters to pass the account access and refresh tokens obtained within the event handler, to the authorization agent.

The ATokenType parameter specifies the received token type that is always the ‘Bearer’ string in case of OAuth 2.0 authorization servers.

The OnReceiveAccessToken event references the TReceiveAccessTokenEvent procedural type.

See Also