OAuthServer

Classes

OAuthServer

Type Definitions

AuthenticateOptions :Object

The OAuth2Server's AuthenticateOptions

Properties:
Name Type Attributes Description
scope Array.<string> <optional>

The scope(s) to authenticate.

addAcceptedScopesHeader boolean <optional>

Set the X-Accepted-OAuth-Scopes HTTP header on response objects.

addAuthorizedScopesHeader boolean <optional>

Set the X-OAuth-Scopes HTTP header on response objects.

allowBearerTokensInQueryString boolean <optional>

Allow clients to pass bearer tokens in the query string of a request.

Source:

AuthorizeOptions :Object

The OAuth2Server's AuthorizeOptions

Properties:
Name Type Attributes Description
authenticateHandler Object <optional>

The authenticate handler

allowEmptyState boolean <optional>

Allow clients to specify an empty state

authorizationCodeLifetime number <optional>

Lifetime of generated authorization codes in seconds (default = 5 minutes).

Source:

ContinueMiddleware :Object

Specify which action should be sent to responder.

Properties:
Name Type Attributes Description
token boolean <optional>

If true, at the end the action will be sent to the responder. (Default: false)

authorize boolean <optional>

If true, at the end the action will be sent to the responder. (Default: false)

Source:

CustomErrorResponse(res, status, message, _error) → {void}

Parameters:
Name Type Description
res ExpressResponse

The response object that you can use to send the response to the client.

status number

The status of the error.

message string

The message of the error. (If the status is >= 500, the message will always be "Internal Server Error")

_error ErrorObject

If the status is >= 500, you can use the error object to check the Server Error

Source:

ErrorObject :Object

Properties:
Name Type Attributes Description
status number <optional>

The error's status code

message string <optional>

The error's message

Source:

ExpressMiddleware(req, res, next) → {Promise.<void>}

Parameters:
Name Type Description
req ExpressRequest

The request object

res ExpressResponse

The response object

next NextFunction

The next function The message of the error. (If the status is >= 500, the message will always be "Internal Server Error")

Source:

OAuthServerOptions :Object

This class extends the ServerOptions class.

Properties:
Name Type Attributes Description
continueMiddleware ContinueMiddleware <optional>

Specify which action should be sent to responder.

model ServerOptions.model

The model for the oauth2server.

accessTokenLifetime number

The expire time in seconds

Source:

TokenOptions :Object

The OAuth2Server's TokenOptions

Properties:
Name Type Attributes Description
accessTokenLifetime number <optional>

Lifetime of generated access tokens in seconds (default = 1 hour)

refreshTokenLifetime number <optional>

Lifetime of generated refresh tokens in seconds (default = 2 weeks)

allowExtendedTokenAttributes boolean <optional>

Allow extended attributes to be set on the returned token

requireClientAuthentication Object <optional>

Require a client secret. Defaults to true for all grant types.

alwaysIssueNewRefreshToken boolean <optional>

Always revoke the used refresh token and issue a new one for the refresh_token grant.

extendedGrantTypes Object.<string, AbstractGrantType> <optional>

Additional supported grant types.

Source: