loginWithDeviceCode method
Implementation
Future<OpenIdIdentity> loginWithDeviceCode() async {
if (_autoRenewTimer != null) _autoRenewTimer = null;
//Make sure we have the discovery information
await _verifyDiscoveryDocument();
//Get the token information and prompt for login if necessary.
try {
final response = await OpenIdConnect.authorizeDevice(
request: DeviceAuthorizationRequest(
clientId: clientId,
scopes: _getScopes(scopes),
audience: audiences != null ? audiences!.join(" ") : null,
configuration: configuration!,
),
);
//Load the idToken here
await _completeLogin(response);
if (autoRefresh) _setupAutoRenew();
_raiseEvent(AuthEvent(AuthEventTypes.Success));
return _identity!;
} on Exception catch (e) {
clearIdentity();
_raiseEvent(AuthEvent(AuthEventTypes.Error, message: e.toString()));
throw AuthenticationException(e.toString());
}
}