reauthenticate method

Future<UserInfo> reauthenticate({
  1. required String redirectURI,
  2. int maxAge = 0,
  3. List<String>? uiLocales,
  4. ColorScheme? colorScheme,
  5. String? wechatRedirectURI,
  6. BiometricOptionsIOS? biometricIOS,
  7. BiometricOptionsAndroid? biometricAndroid,
})

Implementation

Future<UserInfo> reauthenticate({
  required String redirectURI,
  int maxAge = 0,
  List<String>? uiLocales,
  ColorScheme? colorScheme,
  String? wechatRedirectURI,
  BiometricOptionsIOS? biometricIOS,
  BiometricOptionsAndroid? biometricAndroid,
}) async {
  final biometricEnabled = await isBiometricEnabled();
  if (biometricEnabled && biometricIOS != null && biometricAndroid != null) {
    return await authenticateBiometric(
      ios: biometricIOS,
      android: biometricAndroid,
    );
  }

  final codeVerifier = CodeVerifier(_rng);
  final oidcRequest = OIDCAuthenticationRequest(
    clientID: clientID,
    redirectURI: redirectURI,
    responseType: "code",
    scope: [
      "openid",
      "https://authgear.com/scopes/full-access",
    ],
    codeChallenge: codeVerifier.codeChallenge,
    uiLocales: uiLocales,
    colorScheme: colorScheme,
    idTokenHint: idTokenHint,
    maxAge: maxAge,
    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 _finishReauthentication(
      url: Uri.parse(resultURL),
      redirectURI: redirectURI,
      codeVerifier: codeVerifier,
      xDeviceInfo: xDeviceInfo);
}