Module: loopback

Class: AccessToken

AccessToken

Token based authentication and access control.

Default ACLs

  • DENY EVERYONE *
  • ALLOW EVERYONE create
Class Properties
Name Type Description
id String

Generated token ID.

ttl Number

Time to live in seconds, 2 weeks by default.

created Date

When the token was created.

settings Object

Extends the Model.settings object.

settings.accessTokenIdLength Number

Length of the base64-encoded string access token. Default value is 64. Increase the length for a more secure access token.

AccessToken.createAccessTokenId(callback)

Create a cryptographically random access token id.

Arguments
Name Type Description
callback Function
Callback
Name Type Description
err Error
token String

AccessToken.findForRequest(req, [options], callback)

Find a token for the given ServerRequest.

Arguments
Name Type Description
req ServerRequest
[options] Object

Options for finding the token

callback Function
Callback
Name Type Description
err Error
token AccessToken

accessToken.validate(callback)

Validate the token.

Arguments
Name Type Description
callback Function
Callback
Name Type Description
err Error
isValid Boolean