authenticate method

  1. @override
Future<AuthenticationResult?> authenticate({
  1. required OAuthProvider provider,
  2. required Uri redirectUri,
  3. required List<String> scope,
  4. required String responseType,
  5. required String responseMode,
  6. required String? prompt,
  7. required String? codeChallenge,
  8. required String? codeChallengeMethod,
  9. required Map<String, dynamic> otherParams,
  10. required WebAuthenticationMode webMode,
})
override

Implementation

@override
Future<AuthenticationResult?> authenticate({
  required OAuthProvider provider,
  required Uri redirectUri,
  required List<String> scope,
  required String responseType,
  required String responseMode,
  required String? prompt,
  required String? codeChallenge,
  required String? codeChallengeMethod,
  required Map<String, dynamic> otherParams,
  required WebAuthenticationMode webMode,
}) async {
  final authUri = provider.getAuthUri(
    redirectUri: redirectUri,
    scope: scope,
    responseType: responseType,
    responseMode: responseMode,
    prompt: prompt,
    codeChallenge: codeChallenge,
    codeChallengeMethod: codeChallengeMethod,
    otherParams: otherParams,
  );

  final response = await methodChannel.invokeMethod(
    'authenticate',
    {
      'authUri': authUri.toString(),
      'redirectUriScheme': redirectUri.scheme,
    },
  ) as String?;

  if (response == null) {
    return null;
  }

  // TODO check format
  final resultUri = Uri.parse(response);

  return AuthenticationResult(redirect: resultUri);
}