Auth

Auth

Methods

(async, static) acquireTokenSilent(parameters)

Try to obtain token silently without user interaction

Source:
Parameters:
Name Type Description
parameters Object
Name Type Description
userId String

user login name (e.g. from Id token)

scope String

scopes requested for the issued tokens.

(async, static) clearPersistenCache(userId)

Clear persystent cache - AsyncStorage - for given client ID and user ID or ALL users

Source:
Parameters:
Name Type Default Description
userId String null

ID of user whose tokens will be cleared/deleted if ommited - tokens for ALL users and current client will be cleared

(static) exchange(input) → {Promise}

Exchanges a code obtained via /authorize for the access tokens

Source:
See:
Parameters:
Name Type Description
input Object

input used to obtain tokens from a code

Name Type Description
code String

code returned by /authorize.

redirectUri String

original redirectUri used when calling /authorize.

scope String

A space-separated list of scopes. The scopes requested in this leg must be equivalent to or a subset of the scopes requested in the first leg

Returns:
Type:
Promise

(static) loginUrl(parameters) → {String}

Builds the full authorize endpoint url in the Authorization Server (AS) with given parameters.

Source:
See:
Parameters:
Name Type Description
parameters Object

parameters to send to /authorize

Name Type Description
responseType String

type of the response to get from /authorize.

redirectUri String

where the AS will redirect back after success or failure.

state String

random string to prevent CSRF attacks.

scope String

a space-separated list of scopes that you want the user to consent to.

prompt String

(optional) indicates the type of user interaction that is required. The only valid values at this time are 'login', 'none', and 'consent'.

Returns:
Type:
String

authorize url with specified parameters to redirect to for AuthZ/AuthN.

(static) logoutUrl() → {String}

Builds the full logout endpoint url in the Authorization Server (AS) with given parameters. https://login.microsoftonline.com/common/oauth2/logout?post_logout_redirect_uri=[URI]&redirect_uri=[URI]

Source:
Returns:
Type:
String

logout url with default parameter

(static) msGraphRequest(parameters) → {Promise}

Return user information using an access token

Source:
See:
Parameters:
Name Type Description
parameters Object

user info parameters

Name Type Description
token String

user's access token

path String

MS Graph API Path

Returns:
Type:
Promise

(static) refreshTokens(parameters) → {Promise}

Obtain new tokens (access and id) using the Refresh Token obtained during Auth (requesting offline_access scope)

Source:
See:
Parameters:
Name Type Description
parameters Object

refresh token parameters

Name Type Attributes Description
refreshToken String

user's issued refresh token

scope String

scopes requested for the issued tokens.

redirectUri String <optional>

the same redirect_uri value that was used to acquire the authorization_code.

Returns:
Type:
Promise