Skip to main content

IAuth

Methods to get information about the user and access token

Extends

Methods

_dispose()?

optional _dispose(): void;

Returns

void

Inherited from

IScriptingObject._dispose


_toJSON()

_toJSON(): RemotingScriptingObject;

Returns

RemotingScriptingObject

Inherited from

IScriptingObject._toJSON


createAuthCode()

createAuthCode(
clientId: string,
redirectUri: string,
scope: string): Promise<string>;

Deprecated: use getAccessToken method instead

Generates a new Auth Code for the caller which can be exchanged for an Access Token using the Client Secret associated with the given OAuth Client ID. In certain contexts, the Auth token is tied to the currently logged in user's identity

Parameters

clientId

string

unique identifier of the plugin

redirectUri

string

redirect url of the plugin / microapp

scope

string

scope of the plugin / microapp

Returns

Promise<string>

auth code

Example

const authCode = await auth.createAuthCode('abc', 'https://clientx.com', 'lp');

getAccessToken()

getAccessToken(): Promise<TokenInfo>;

Get child access token for the given microapp / customization Host implementing this scripting object method, should able to find out the caller of this api and request necessary child token

Returns

Promise<TokenInfo>

access token with the api base url

Throws

if the customization, requesting the token, doesn not have active subscription to developer connect product

Example

const token = await auth.getAccessToken();

getUser()

getUser(): Promise<User>;

Get current logged in user information

Returns

Promise<User>

user information

Properties

id

readonly id: string;

Inherited from

IScriptingObject.id


objectType

readonly objectType: string;

Inherited from

IScriptingObject.objectType