Skip to content

AuthorizationCodeGrantType

Kind: global class

new AuthorizationCodeGrantType(options)

Param
options

authorizationCodeGrantType.handle(request, client)

Handle authorization code grant.

Kind: instance method of AuthorizationCodeGrantType
See: https://tools.ietf.org/html/rfc6749#section-4.1.3

ParamType
requestRequest
clientClientData

authorizationCodeGrantType.getAuthorizationCode(request, client) ⇒ Promise.<{user}>

Get the authorization code.

Kind: instance method of AuthorizationCodeGrantType

ParamType
requestRequest
clientClientData

authorizationCodeGrantType.validateRedirectUri(request, code)

Validate the redirect URI.

"The authorization server MUST ensure that the redirect_uri parameter is present if the redirect_uri parameter was included in the initial authorization request as described in Section 4.1.1, and if included ensure that their values are identical."

Kind: instance method of AuthorizationCodeGrantType
See: https://tools.ietf.org/html/rfc6749#section-4.1.3

ParamType
requestRequest
codeAuthorizationCodeData

authorizationCodeGrantType.revokeAuthorizationCode(code)

Revoke the authorization code.

"The authorization code MUST expire shortly after it is issued to mitigate the risk of leaks. [...] If an authorization code is used more than once, the authorization server MUST deny the request."

Kind: instance method of AuthorizationCodeGrantType
See: https://tools.ietf.org/html/rfc6749#section-4.1.2

ParamType
codeAuthorizationCodeData

authorizationCodeGrantType.saveToken(user, client, authorizationCode, requestedScope)

Save token.

Kind: instance method of AuthorizationCodeGrantType

ParamType
userobject
clientClientData
authorizationCodestring
requestedScopestring