MsalProvider Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
MSAL.NET provider helper for tracking authentication state.
public class MsalProvider : CommunityToolkit.Authentication.BaseProvider
type MsalProvider = class
inherit BaseProvider
Public Class MsalProvider
Inherits BaseProvider
- Inheritance
Constructors
| MsalProvider(IPublicClientApplication, String[], Boolean) |
Initializes a new instance of the MsalProvider class using a configuration object. |
| MsalProvider(String, String[], String, Boolean, Boolean, String) |
Initializes a new instance of the MsalProvider class with default configuration values. |
Fields
| MSAccountBrokerRedirectUriPrefix |
A prefix value used to create the redirect URI value for use in AAD. |
Properties
| Account |
Gets or sets the currently authenticated user account. |
| Client |
Gets or sets the MSAL.NET Client used to authenticate the user. |
| CurrentAccountId |
Gets the id of the currently signed in user account. |
| Scopes |
Gets an array of scopes to use for accessing Graph resources. |
| State |
Gets or sets the current state of the provider. (Inherited from BaseProvider) |
Methods
| AddSdkVersion(HttpRequestMessage) |
Append the Sdk version to the request headers. (Inherited from BaseProvider) |
| AuthenticateRequestAsync(HttpRequestMessage) |
Authenticate an outgoing request. |
| CreatePublicClientApplication(String, String, String, Boolean) |
Create an instance of PublicClientApplication using the provided config and some default values. |
| GetTokenAsync(Boolean) |
Retrieve a token for the authenticated user. |
| GetTokenWithScopesAsync(String[], Boolean) |
Retrieve an authorization token using the provided scopes. |
| SignInAsync() |
Sign in the user. |
| SignOutAsync() |
Sign out the user. |
| TrySilentSignInAsync() |
Tries to check if the user is logged in without prompting to login. |
Events
| StateChanged |
Event called when the login State changes. (Inherited from BaseProvider) |
Extension Methods
| InitTokenCacheAsync(MsalProvider, StorageCreationProperties, TraceSource) |
Helper function to initialize the token cache for non-UWP apps. MSAL handles this automatically on UWP. |
| GetBetaClient(IProvider) |
Gets a GraphServiceClient instance based on the current GlobalProvider, but configured for the beta endpoint. |
| GetClient(IProvider) |
Gets a GraphServiceClient instance based on the current GlobalProvider. |