TsgcHTTP_OAuth2_ClientEvents › OnDeviceCodeExpired

OnDeviceCodeExpired Event

Fires when the device code expires before the user completes authorization.

Syntax

property OnDeviceCodeExpired: TsgcOnAuth2DeviceCodeExpired;
// TsgcOnAuth2DeviceCodeExpired = procedure(Sender: TObject) of object

Default Value

Remarks

OnDeviceCodeExpired is raised when the token endpoint answers the Device Code polling loop with the expired_token error defined by RFC 8628 section 3.5, meaning the lifetime announced in OnDeviceCode.ExpiresIn ran out before the user approved the request on the secondary device. The component stops polling; the typical reaction is to inform the user and restart the flow (call Start again) so the authorization server issues a fresh device code.

Example


procedure OnOAuth2DeviceCodeExpired(Sender: TObject);
begin
  DoLog('Device code expired before the user authorized, requesting a new one...');
  OAuth2Client.Start;
end;

Back to Events