Creates an instance of TokenManager.
const tokenManager = new TokenManager('your-client-id', 'your-client-secret');
The client ID of the service app.
The client secret of the service app.
The base URL for the API. Defaults to PRODUCTION_BASE_URL
.
Update the tokens and their expiration times.
await tokenManager.updateServiceAppToken(tokenResponse, 'org-id');
The token response data.
The organization ID.
Get the service app authorization data for a given organization ID.
const authorization = await tokenManager.getOrgServiceAppAuthorization('org-id');
The organization ID.
Retrieve a new service app token using the service app owner's personal access token(PAT).
await tokenManager.getServiceAppTokenUsingPAT('org-id', 'personal-access-token');
The organization ID.
The service app owner's personal access token or token from an integration that has the scope spark:applications_token
.
Refresh the access token using the refresh token.
await tokenManager.refreshServiceAppAccessToken('org-id');
The organization ID.
Save the service app registration using the provided refresh token. After saving, it can be fetched by using the getOrgServiceAppAuthorization method.
await tokenManager.saveServiceAppRegistrationData('org-id', 'refresh-token');
The organization ID.
The refresh token.
The token manager for the BYoDS SDK.