Home Reference Source Test Repository
import OAuth2ConnectorBase from '@hoist/oauth-connector/src/oauth2_connector.js'
protected class | source

OAuth2ConnectorBase

Constructor Summary

Protected Constructor
protected

constructor(configuration: object)

Method Summary

Public Methods
public

authorize(authorization: <AuthorizationStore>)

authorize the oauth connection with existing parameters
public

receiveBounce(authorization: AuthorizationStore): *

Protected Methods
protected
Populate any extra params needed to request the access token
protected
Populate any extra params needed to grant access

Protected Constructors

protected constructor(configuration: object) source

Params:

NameTypeAttributeDescription
configuration object

the configuration details for this connector

configuration.clientId string

the OAuth2 client id

configuration.clientSecret string

the OAuth2 client secret

configuration.baseSite string

the base uri to use for authorization calls

configuration.authorizationPath string
  • optional
  • default: /oauth/authorize

the path to send users to authorise access

configuration.accessTokenPath string
  • optional
  • default: /oauth/access_token

the path to use to retrieve access tokens

configuration.customHeaders object
  • optional

any custom headers to send

Public Methods

public authorize(authorization: <AuthorizationStore>) source

authorize the oauth connection with existing parameters

Params:

NameTypeAttributeDescription
authorization <AuthorizationStore>

the users authorization

public receiveBounce(authorization: AuthorizationStore): * source

Params:

NameTypeAttributeDescription
authorization AuthorizationStore

the users authorization

Return:

*

Protected Methods

protected _accessParams(authorization: AuthorizationStore): Promise<object> source

Populate any extra params needed to request the access token

Params:

NameTypeAttributeDescription
authorization AuthorizationStore

the users authorisation store

Return:

Promise<object>

an object containing key value pairs to send with the access token request

protected _authorizeParams(authorization: AuthorizationStore): Promise<object> source

Populate any extra params needed to grant access

Params:

NameTypeAttributeDescription
authorization AuthorizationStore

the users authorisation store

Return:

Promise<object>

an object containing key value pairs to send with the client to the authorization url