Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
IPublicClientApplication interface
- Package:
- @azure/msal-node
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 |
| getAllAccounts() | Gets all cached accounts |
| 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 |
| signOut(SignOutRequest) | Removes cache artifacts associated with the given account |
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
- request
- AuthorizationCodeRequest
Returns
Promise<AuthenticationResult>
acquireTokenByDeviceCode(DeviceCodeRequest)
Acquires a token from the authority using OAuth2.0 device code flow
function acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<null | AuthenticationResult>
Parameters
- request
- DeviceCodeRequest
Returns
Promise<null | AuthenticationResult>
acquireTokenByRefreshToken(RefreshTokenRequest)
Acquires a token by exchanging the refresh token provided for a new set of tokens
function acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<null | AuthenticationResult>
Parameters
- request
- RefreshTokenRequest
Returns
Promise<null | AuthenticationResult>
acquireTokenByUsernamePassword(UsernamePasswordRequest)
Warning
This API is now deprecated.
- Use a more secure flow instead
Acquires tokens with password grant by exchanging client applications username and password for credentials
function acquireTokenByUsernamePassword(request: UsernamePasswordRequest): Promise<null | AuthenticationResult>
Parameters
- request
- UsernamePasswordRequest
Returns
Promise<null | AuthenticationResult>
acquireTokenInteractive(InteractiveRequest)
Acquires a token interactively
function acquireTokenInteractive(request: InteractiveRequest): Promise<AuthenticationResult>
Parameters
- request
- InteractiveRequest
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>
Parameters
- request
- SilentFlowRequest
Returns
Promise<AuthenticationResult>
clearCache()
Clear the cache
function clearCache()
getAllAccounts()
Gets all cached accounts
function getAllAccounts(): Promise<AccountInfo[]>
Returns
Promise<AccountInfo[]>
getAuthCodeUrl(AuthorizationUrlRequest)
Creates the URL of the authorization request
function getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string>
Parameters
- request
- AuthorizationUrlRequest
Returns
Promise<string>
getLogger()
getTokenCache()
setLogger(Logger)
Replaces the default logger set in configurations with new Logger with new configurations
function setLogger(logger: Logger)
Parameters
- logger
- Logger
signOut(SignOutRequest)
Removes cache artifacts associated with the given account
function signOut(request: SignOutRequest): Promise<void>
Parameters
- request
- SignOutRequest
Returns
Promise<void>
