loginInteractive method
Implementation
Future<OpenIdIdentity> loginInteractive({
required BuildContext context,
required String title,
String? userNameHint,
Map<String, String>? additionalParameters,
Iterable<String>? prompts,
bool useWebPopup = true,
int popupWidth = 640,
int popupHeight = 600,
}) async {
if (this.redirectUrl == null)
throw StateError(
"When using login interactive, you must create the client with a redirect url.");
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.authorizeInteractive(
context: context,
title: title,
request: await InteractiveAuthorizationRequest.create(
configuration: configuration!,
clientId: clientId,
redirectUrl: this.redirectUrl!,
clientSecret: this.clientSecret,
loginHint: userNameHint,
additionalParameters: additionalParameters,
scopes: _getScopes(scopes),
autoRefresh: autoRefresh,
prompts: prompts,
useWebPopup: useWebPopup,
popupHeight: popupHeight,
popupWidth: popupWidth,
),
);
if (response == null) throw StateError(ERROR_USER_CLOSED);
//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());
}
}