OAuth2Boom
OAuth2.0 Errors using Boom
Lead Maintainer: Andy Nguyen
- OAuth2Boom
- Helper Methods
- HTTP 400 Errors
OAuth2Boom.invalidClient([message], [data])
OAuth2Boom.invalidRequest([message], [data])
OAuth2Boom.invalidParam([message], [data])
OAuth2Boom.invalidRedirectURI([message], [data])
OAuth2Boom.unsupportedOverHTTP([message], [data])
OAuth2Boom.unsupportedResponseType([message], [data])
OAuth2Boom.unsupportedGrantType([message], [data])
OAuth2Boom.unsupportedRedirectURI([message], [data])
OAuth2Boom.versionRejected([message], [data])
- HTTP 401 Errors
Description
oauth2boom provides a set of utilities for returning OAuth 2.0 errors through Boom. Each utility returns a Boom
error response.
In addition to the Boom properties, the following property is added to the error response:
toURIFrag
- function to transform the error into a URI fragment string.
The OAuth 2.0 errors are based off of the Yahoo OAuth 2.0 guide.
Helper Methods
create(errorCode, [message], [data])
Generates an Error
object with the boom decorations where:
errorCode
- an OAuth 2.0 error code.message
- optional message string that will override the preset message.data
- additional error data set toerror.data
property.
var error = OAuth2Boom;
createNew(errorCode, [statusCode], [message], [data])
Generates an Error
object with the boom decorations and a custom error code where:
errorCode
- an error code.statusCode
- an HTTP error code number. Must be greater or equal 400.message
- optional message string that will override the preset message.data
- additional error data set toerror.data
property.
var error = OAuth2Boom;
wrap(error, [errorCode], [statusCode], [message])
Decorates an error with the boom properties and a toURIFrag method where:
error
- the error object to wrap. Iferror
is already a boom object, returns back the same object.errorCode
- optional error code that will override the error name set by Boom.statusCode
- optional HTTP status code. Defaults to500
.message
- optional message string. If the error already has a message, it adds the message as a prefix. Defaults to no message.
var error = 'Unexpected input';OAuth2Boom;
HTTP 400 Errors
OAuth2Boom.invalidClient([message], [data])
Returns an invalid_client error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.invalidRequest([message], [data])
Returns an invalid_request error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.invalidParam([message], [data])
Returns an invalid_param error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.invalidRedirectURI([message], [data])
Returns an invalid_redirect_uri error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.unsupportedOverHTTP([message], [data])
Returns an unsupported_over_http error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.unsupportedResponseType([message], [data])
Returns an unsupported_response_type error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.unsupportedGrantType([message], [data])
Returns an unsupported_grant_type error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.unsupportedRedirectURI([message], [data])
Returns an unsupported_redirect_uri error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.versionRejected([message], [data])
Returns an version_rejected error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
HTTP 401 Errors
OAuth2Boom.invalidToken([message], [data])
Returns an invalid_token error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.invalidCallback([message], [data])
Returns an invalid_callback error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.invalidClientSecret([message], [data])
Returns an invalid_client_secret error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.invalidGrant([message], [data])
Returns an invalid_grant error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.tokenExpired([message], [data])
Returns a token_expired error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload:
OAuth2Boom.unauthorizedClient([message], [data])
Returns an unauthorized_client error where:
message
- optional message string that will override the preset message.data
- optional additional error data.
OAuth2Boom;
Generates the following response payload: