signIn method

Default signIn with webView flow

Implementation

Future<SocialSignInResultInterface> signIn(BuildContext context) async {
  stateCode = customStateCode() ?? generateString(10); // simple state code
  debugPrint("stateCode = $stateCode");

  var authorizedResult = await signInWithWebView(context);
  if (authorizedResult == null ||
      authorizedResult.toString().contains('access_denied')) {
    throw SocialSignInException(
        status: SignInResultStatus.cancelled,
        description: "Sign In attempt has been cancelled.");
  } else if (authorizedResult is Exception) {
    throw SocialSignInException(description: authorizedResult.toString());
  }
  String authorizedCode = authorizedResult;
  debugPrint("authorized_code: $authorizedCode");
  return await exchangeAccessToken(authorizedCode);
}