View source: R/credential-azure-cli.R
| write_msal_token | R Documentation |
Writes an httr2::oauth_token() object into the MSAL token cache JSON file
(msal_token_cache.json) shared by the Azure SDK and Azure CLI. The
resulting entry is readable by other Azure tools (Python SDK, Azure CLI,
and the rest of this package via az_cli_get_cached_token()).
write_msal_token(token, cache_file = default_msal_token_cache())
token |
An |
cache_file |
Path to the MSAL token cache JSON file. Defaults to
|
The function adds or overwrites AccessToken, RefreshToken (when the
token carries a refresh token), Account, and AppMetadata sections.
Existing entries for other accounts or clients are preserved.
The home_account_id follows the MSAL convention
"<object_id>.<tenant_id>" where object_id is the Azure AD OID of the
authenticated principal. Cache entry keys are built in the same format used
by the Azure CLI and MSAL Python:
AccessToken: <home_account_id>-<environment>-accesstoken-<client_id>-<realm>-<target>
RefreshToken: <home_account_id>-<environment>-refreshtoken-<client_id>--
Account: <home_account_id>-<environment>-<realm>
AppMetadata: appmetadata-<environment>-<client_id>
Invisibly returns the path to the cache file.
az_cli_get_cached_token(), httr2::oauth_token()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.