signInSite method

  1. @override
Future<SocialSignInResultInterface> signInSite(
  1. SocialPlatform site,
  2. BuildContext context
)
override

Returns the credentials state for a given user by SocialSignInResultInterface Get the credentials and authorization of social login, it will convert an authorization code obtained via Social sign into a session in your system. Throw exception when errors happen.

Implementation

@override
Future<SocialSignInResultInterface> signInSite(
    SocialPlatform site, BuildContext context) async {
  try {
    var socialSite = SocialSignInPlatform.getSite(site);
    if (socialSite == null)
      return SocialSignInFail(errorMessage: "Uninitialized site");
    return await socialSite.signIn(context);
  } catch (e) {
    if (e is SocialSignInException) {
      return SocialSignInFail(status: e.status, errorMessage: e.description);
    } else {
      return SocialSignInFail(errorMessage: e.toString());
    }
  }
}