MsalTokenProvider class
Provides tokens using MSAL.
Constructors
| Msal |
Creates an MSAL token provider. |
Properties
| connection |
Authentication settings used by overloads that do not accept an explicit configuration. |
Methods
| acquire |
Acquires a delegated token using explicit authentication settings. |
| acquire |
Acquires a delegated token using this provider's connection settings. |
| clear |
Clears process-wide auth caches. |
| get |
Gets an access token. |
| get |
Gets an access token using the auth configuration from the MsalTokenProvider instance and the provided scope. |
| get |
Gets the application token used to authenticate an agent application instance. |
| get |
Gets a federated token for an agent application instance. |
| get |
Gets a delegated token for an agentic user. |
Constructor Details
MsalTokenProvider(AuthConfiguration)
Creates an MSAL token provider.
new MsalTokenProvider(connectionSettings?: AuthConfiguration)
Parameters
- connectionSettings
- AuthConfiguration
Default authentication settings for token acquisition.
Property Details
connectionSettings
Authentication settings used by overloads that do not accept an explicit configuration.
connectionSettings?: AuthConfiguration
Property Value
Method Details
acquireTokenOnBehalfOf(AuthConfiguration, string[], string)
Acquires a delegated token using explicit authentication settings.
function acquireTokenOnBehalfOf(authConfig: AuthConfiguration, scopes: string[], oboAssertion: string): Promise<string>
Parameters
- authConfig
- AuthConfiguration
Authentication configuration.
- scopes
-
string[]
Scopes requested for the delegated token.
- oboAssertion
-
string
User assertion exchanged for the token.
Returns
Promise<string>
The delegated access token.
acquireTokenOnBehalfOf(string[], string)
Acquires a delegated token using this provider's connection settings.
function acquireTokenOnBehalfOf(scopes: string[], oboAssertion: string): Promise<string>
Parameters
- scopes
-
string[]
Scopes requested for the delegated token.
- oboAssertion
-
string
User assertion exchanged for the token.
Returns
Promise<string>
The delegated access token.
clearSharedCaches()
Clears process-wide auth caches.
static function clearSharedCaches()
getAccessToken(AuthConfiguration, string)
Gets an access token.
function getAccessToken(authConfig: AuthConfiguration, scope: string): Promise<string>
Parameters
- authConfig
- AuthConfiguration
The authentication configuration.
- scope
-
string
The scope for the token.
Returns
Promise<string>
A promise that resolves to the access token.
getAccessToken(string)
Gets an access token using the auth configuration from the MsalTokenProvider instance and the provided scope.
function getAccessToken(scope: string): Promise<string>
Parameters
- scope
-
string
The scope for the token.
Returns
Promise<string>
A promise that resolves to the access token.
getAgenticApplicationToken(string, string)
Gets the application token used to authenticate an agent application instance.
function getAgenticApplicationToken(tenantId: string, agentAppInstanceId: string): Promise<string>
Parameters
- tenantId
-
string
Microsoft Entra tenant ID.
- agentAppInstanceId
-
string
Agent application instance ID.
Returns
Promise<string>
The agentic application token.
getAgenticInstanceToken(string, string)
Gets a federated token for an agent application instance.
function getAgenticInstanceToken(tenantId: string, agentAppInstanceId: string): Promise<string>
Parameters
- tenantId
-
string
Microsoft Entra tenant ID.
- agentAppInstanceId
-
string
Agent application instance ID.
Returns
Promise<string>
The agent instance token.
getAgenticUserToken(string, string, string, string[])
Gets a delegated token for an agentic user.
function getAgenticUserToken(tenantId: string, agentAppInstanceId: string, agenticUserId: string, scopes: string[]): Promise<string>
Parameters
- tenantId
-
string
Microsoft Entra tenant ID.
- agentAppInstanceId
-
string
Agent application instance ID.
- agenticUserId
-
string
ID of the user represented by the token.
- scopes
-
string[]
Scopes requested for the token.
Returns
Promise<string>
The agentic user token.