Class: JWTUtils
Defined in: core/src/JWTUtils.ts:145
Utility class for working with Json Web Token (JWT) authentication tokens.
Constructors
Constructor
new JWTUtils():
JWTUtils
Returns
JWTUtils
Methods
createToken()
staticcreateToken(config,user,data?):Promise<string>
Defined in: core/src/JWTUtils.ts:192
Parameters
config
user
data?
any
Returns
Promise<string>
createTokenSync()
staticcreateTokenSync(config,user,data?):string
Defined in: core/src/JWTUtils.ts:241
Parameters
config
user
data?
any
Returns
string
decodeToken()
staticdecodeToken(config,token):Promise<JWTPayload>
Defined in: core/src/JWTUtils.ts:298
Decodes the given JWT authentication token using the provided configuration. If the token is not valid an error is thrown with the reason. Returns the encoded user object payload upon success.
Parameters
config
The JWT configuration to use when validating the token.
token
string
The JWT token to validate.
Returns
Promise<JWTPayload>
The data encoded in the token's payload.
decodeTokenSync()
staticdecodeTokenSync(config,token):JWTPayload
Defined in: core/src/JWTUtils.ts:349
Decodes the given JWT authentication token using the provided configuration. If the token is not valid an error is thrown with the reason. Returns the encoded user object payload upon success.
Parameters
config
The JWT configuration to use when validating the token.
token
string
The JWT token to validate.
Returns
The data encoded in the token's payload.