authenticate method
Future<UserInfo>
authenticate({
- required String redirectURI,
- List<
PromptOption> ? prompt, - List<
String> ? uiLocales, - ColorScheme? colorScheme,
- AuthenticationPage? page,
- String? wechatRedirectURI,
Implementation
Future<UserInfo> authenticate({
required String redirectURI,
List<PromptOption>? prompt,
List<String>? uiLocales,
ColorScheme? colorScheme,
AuthenticationPage? page,
String? wechatRedirectURI,
}) async {
final codeVerifier = CodeVerifier(_rng);
final oidcRequest = OIDCAuthenticationRequest(
clientID: clientID,
redirectURI: redirectURI,
responseType: "code",
scope: [
"openid",
"offline_access",
"https://authgear.com/scopes/full-access",
],
codeChallenge: codeVerifier.codeChallenge,
prompt: prompt,
uiLocales: uiLocales,
colorScheme: colorScheme,
page: page,
suppressIDPSessionCookie: !shareSessionWithSystemBrowser,
wechatRedirectURI: wechatRedirectURI,
);
final config = await _apiClient.fetchOIDCConfiguration();
final authenticationURL = Uri.parse(config.authorizationEndpoint)
.replace(queryParameters: oidcRequest.toQueryParameters());
final resultURL = await native.authenticate(
url: authenticationURL.toString(),
redirectURI: redirectURI,
preferEphemeral: !shareSessionWithSystemBrowser,
wechatRedirectURI: wechatRedirectURI,
onWechatRedirectURI: _onWechatRedirectURI,
);
final xDeviceInfo = await _getXDeviceInfo();
return await _finishAuthentication(
url: Uri.parse(resultURL),
redirectURI: redirectURI,
codeVerifier: codeVerifier,
xDeviceInfo: xDeviceInfo);
}