Class: OAuth2Client

OAuth2Client(options)

new OAuth2Client(options)

Construct an OAuth2Client instance, which handles OAuth2Account management.

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
id string <optional>

OAuth2 client identifier, or auto-generated uuid

url string

OAuth2 authorization url

tokenEndpoint string

OAuth2 token endpoint

key string

OAuth2 client key

secret string

OAuth2 client secret

refreshingEnabled string <optional>
true

OAuth2 refresh grant enabled

allowMultipleAccounts string

Specifies whether multiple accounts per client are allowed

Methods

createAccount(options) → {OAuth2Account|Error}

Factory method that will create a OAuth2Account.

Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
id string <optional>

OAuth2 account identifier, or auto-generated uuid

oauth2Client OAuth2Client <optional>

OAuth2Client associated with the to be created OAuth2Account

oauth2Device OAuth2Device <optional>

OAuth2Device associated with the to be created OAuth2Account

refreshingEnabled string <optional>
true

OAuth2 refresh grant enabled

refreshToken string <optional>

OAuth2 refresh token

accessToken string <optional>

OAuth2 access token

expiresIn string | Date <optional>

Date object or string indicating when access token expires

Returns:
Type
OAuth2Account | Error

deleteAccount(account)

Method that will delete a provided OAuth2Account. It calls the instance's destroy method and removes it from the accounts list.

Parameters:
Name Type Description
account OAuth2Account

OAuth2Account to be deleted

getAccount(id) → {OAuth2Account|Error}

Method that will return OAuth2Account if found by matching provided id.

Parameters:
Name Type Description
id string
Returns:
Type
OAuth2Account | Error

getStoreValues() → {Object}

Returns important values that should be stored persistently.

Returns:
Type
Object

registeredAccounts() → {Array}

Method that returns the accounts list of this client.

Returns:
Type
Array