reauthenticate method

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

Implementation

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

  final idTokenHint = this.idTokenHint;

  if (idTokenHint == null) {
    throw Exception("authenticated user required");
  }

  final options = ReauthenticateOptions(
    redirectURI: redirectURI,
    isSsoEnabled: isSsoEnabled,
    uiLocales: uiLocales,
    colorScheme: colorScheme,
    oauthProviderAlias: oauthProviderAlias,
    wechatRedirectURI: wechatRedirectURI,
    maxAge: maxAge,
    authenticationFlowGroup: authenticationFlowGroup,
  );

  final request =
      await internalCreateReauthenticateRequest(idTokenHint, options);

  if (wechatRedirectURI != null) {
    await native.registerWechatRedirectURI(
        onWechatRedirectURI: _onWechatRedirectURI,
        wechatRedirectURI: wechatRedirectURI);
  }

  final resultURL = await _uiImplementation.openAuthorizationURL(
    url: request.url.toString(),
    redirectURI: redirectURI,
    shareCookiesWithDeviceBrowser: isSsoEnabled,
  );
  final xDeviceInfo = await _getXDeviceInfo();
  return await _finishReauthentication(
      url: Uri.parse(resultURL),
      redirectURI: redirectURI,
      codeVerifier: request.verifier,
      xDeviceInfo: xDeviceInfo);
}