IPublicClientApplication interface

Interface for the PublicClientApplication class defining the public API signatures

Methods

acquireTokenByCode(AuthorizationCodeRequest)

Acquires a token by exchanging the authorization code received from the first step of OAuth 2.0 Authorization Code Flow

acquireTokenByDeviceCode(DeviceCodeRequest)

Acquires a token from the authority using OAuth2.0 device code flow

acquireTokenByRefreshToken(RefreshTokenRequest)

Acquires a token by exchanging the refresh token provided for a new set of tokens

acquireTokenByUsernamePassword(UsernamePasswordRequest)

Acquires tokens with password grant by exchanging client applications username and password for credentials

acquireTokenInteractive(InteractiveRequest)

Acquires a token interactively

acquireTokenSilent(SilentFlowRequest)

Acquires a token silently when a user specifies the account the token is requested for

clearCache()

Clear the cache

getAuthCodeUrl(AuthorizationUrlRequest)

Creates the URL of the authorization request

getLogger()

Returns the logger instance

getTokenCache()

Gets the token cache for the application

setLogger(Logger)

Replaces the default logger set in configurations with new Logger with new configurations

Method Details

acquireTokenByCode(AuthorizationCodeRequest)

Acquires a token by exchanging the authorization code received from the first step of OAuth 2.0 Authorization Code Flow

function acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>

Parameters

Returns

Promise<AuthenticationResult>

acquireTokenByDeviceCode(DeviceCodeRequest)

Acquires a token from the authority using OAuth2.0 device code flow

function acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult | null>

Parameters

Returns

Promise<AuthenticationResult | null>

acquireTokenByRefreshToken(RefreshTokenRequest)

Acquires a token by exchanging the refresh token provided for a new set of tokens

function acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<AuthenticationResult | null>

Parameters

Returns

Promise<AuthenticationResult | null>

acquireTokenByUsernamePassword(UsernamePasswordRequest)

Acquires tokens with password grant by exchanging client applications username and password for credentials

function acquireTokenByUsernamePassword(request: UsernamePasswordRequest): Promise<AuthenticationResult | null>

Parameters

Returns

Promise<AuthenticationResult | null>

acquireTokenInteractive(InteractiveRequest)

Acquires a token interactively

function acquireTokenInteractive(request: InteractiveRequest): Promise<AuthenticationResult>

Parameters

Returns

Promise<AuthenticationResult>

acquireTokenSilent(SilentFlowRequest)

Acquires a token silently when a user specifies the account the token is requested for

function acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult | null>

Parameters

Returns

Promise<AuthenticationResult | null>

clearCache()

Clear the cache

function clearCache()

getAuthCodeUrl(AuthorizationUrlRequest)

Creates the URL of the authorization request

function getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string>

Parameters

Returns

Promise<string>

getLogger()

Returns the logger instance

function getLogger(): Logger

Returns

Logger

getTokenCache()

Gets the token cache for the application

function getTokenCache(): TokenCache

Returns

setLogger(Logger)

Replaces the default logger set in configurations with new Logger with new configurations

function setLogger(logger: Logger)

Parameters

logger

Logger