handleUnSuccessCodeFail method

Exception handleUnSuccessCodeFail(
  1. Response response
)

The error will be thrown when the token exchange fails.

Implementation

Exception handleUnSuccessCodeFail(Response response) {
  var body =
      json.decode(utf8.decode(response.bodyBytes)) as Map<String, dynamic>;
  if (body.containsKey("error")) {
    return SocialSignInException(
        description:
            "Unable to obtain token. Received: ${body["error_description"]}");
  } else {
    return SocialSignInException(
        description:
            "Unable to obtain token. Received: ${response.statusCode}");
  }
}