AuthenticationResultExtensions.GetRefreshToken(AuthenticationResult) Method

Definition

Returns the refresh token from the authentication result, if available. This is intended for advanced scenarios where the caller manages its own token cache, for example when using DisableInternalCacheOptions.

public static string GetRefreshToken(this Microsoft.Identity.Client.AuthenticationResult result);
static member GetRefreshToken : Microsoft.Identity.Client.AuthenticationResult -> string
<Extension()>
Public Function GetRefreshToken (result As AuthenticationResult) As String

Parameters

result
AuthenticationResult

The authentication result.

Returns

The refresh token string associated with the result for confidential client flows, if available. This may be a refresh token returned in the token response or a refresh token used for the acquisition and carried on the result; null otherwise. Refresh tokens are not exposed for public client flows, client credentials, managed identity, or when the token was served from cache. For the normal (non-long-running) On-Behalf-Of flow, MSAL intentionally clears the refresh token, so this method will also return null.

Remarks

Refresh tokens are long-lived credentials. Store them securely and never expose them to end users or untrusted code.

Applies to