errorString static method Null safety

String? errorString(
  1. AuthRequestError error
)

Returns a string suitable to be included in a query string or JSON response body to indicate the error during processing an OAuth 2.0 request.

Implementation

static String? errorString(AuthRequestError error) {
  switch (error) {
    case AuthRequestError.invalidRequest:
      return "invalid_request";
    case AuthRequestError.invalidClient:
      return "invalid_client";
    case AuthRequestError.invalidGrant:
      return "invalid_grant";
    case AuthRequestError.invalidScope:
      return "invalid_scope";
    case AuthRequestError.invalidToken:
      return "invalid_token";

    case AuthRequestError.unsupportedGrantType:
      return "unsupported_grant_type";
    case AuthRequestError.unsupportedResponseType:
      return "unsupported_response_type";

    case AuthRequestError.unauthorizedClient:
      return "unauthorized_client";
    case AuthRequestError.accessDenied:
      return "access_denied";

    case AuthRequestError.serverError:
      return "server_error";
    case AuthRequestError.temporarilyUnavailable:
      return "temporarily_unavailable";
  }
}