injected service use to handle the onetime token related operations
authenticate secrets
custom authentication function
injected logger used to handle the logging
request context [headers, body, params, query]. Note:
body.fingerprint
defaulted to empty stringbody.target
defaulted to undefined200 Status OK
// If token type is access
{
data: {
userId: string;
},
status: number;
}
// If token type is onetime
{
data: object;
status: number;
}
This handler will create check token by applying the following steps in sequence:
Get token, fingerprint, target from request body
Get ip and host from request info
Check token (crypto.checkJWT)
Check token type (access or onetime)
If token type is access, check passes security checks and then return userId
If token type is onetime, check request token
6.1. If request token is undefined, throw NBError
6.2. If request token is not app access token, throw NBError
6.3. If request token is app access token, check token is valid (onetimeTokenService.isValidOnetimeToken)
6.3.1. If token is valid, invalidate token (onetimeTokenService.invalidateToken) and return token data
6.3.2. If token is invalid, throw NBError
400 NBError Bad Request
403 NBError Forbidden
Generated using TypeDoc
Check token handler