Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidRequest = &OAuth2Error{ ErrorType: "invalid_request", HTTPStatus: http.StatusBadRequest, } ErrInvalidClient = &OAuth2Error{ ErrorType: "invalid_client", HTTPStatus: http.StatusUnauthorized, } ErrInvalidGrant = &OAuth2Error{ ErrorType: "invalid_grant", HTTPStatus: http.StatusBadRequest, } ErrorType: "unauthorized_client", HTTPStatus: http.StatusBadRequest, } ErrUnsupportedGrantType = &OAuth2Error{ ErrorType: "unsupported_grant_type", HTTPStatus: http.StatusBadRequest, } ErrInvalidScope = &OAuth2Error{ ErrorType: "invalid_scope", HTTPStatus: http.StatusBadRequest, } ErrInvalidRedirectURI = &OAuth2Error{ ErrorType: "invalid_request", ErrorCode: "invalid_redirect_uri", HTTPStatus: http.StatusBadRequest, } ErrClientAlreadyExists = &OAuth2Error{ ErrorType: "invalid_request", ErrorCode: "client_already_exists", HTTPStatus: http.StatusBadRequest, } ErrAuthorizationCodeExpired = &OAuth2Error{ ErrorType: "invalid_grant", ErrorCode: "code_expired", HTTPStatus: http.StatusBadRequest, } ErrAuthorizationCodeNotFound = &OAuth2Error{ ErrorType: "invalid_grant", ErrorCode: "invalid_code", HTTPStatus: http.StatusBadRequest, } ErrTokenExpired = &OAuth2Error{ ErrorType: "invalid_token", ErrorCode: "token_expired", HTTPStatus: http.StatusBadRequest, } ErrTokenNotFound = &OAuth2Error{ ErrorType: "invalid_token", ErrorCode: "invalid_token", HTTPStatus: http.StatusBadRequest, } ErrOAuth2NotEnabled = &OAuth2Error{ ErrorType: "invalid_request", ErrorCode: "oauth2_not_enabled", HTTPStatus: http.StatusBadRequest, } )
Functions ¶
This section is empty.
Types ¶
type OAuth2Error ¶
type OAuth2Error struct {
ErrorType string `json:"error"`
ErrorDescription string `json:"error_description,omitempty"`
ErrorURI string `json:"error_uri,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
HTTPStatus int `json:"-"`
}
func ConvertToOAuth2Error ¶
func ConvertToOAuth2Error(err error) *OAuth2Error
ConvertToOAuth2Error converts any error to OAuth2Error If the error is already OAuth2Error, return it directly Otherwise, wrap it as an unknown error with the original error message
func (*OAuth2Error) Error ¶
func (e *OAuth2Error) Error() string
Click to show internal directories.
Click to hide internal directories.