title | author | description | keywords | dev_langs | |
---|---|---|---|---|---|
InteractiveProviderBehavior XAML Behavior |
michael-hawker |
The InteractiveProviderBehavior provides an easy way in XAML to connect to Microsoft Graph. |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, graph, login, authentication, interactive, provider, identity, xaml islands |
|
The InteractiveProviderBehavior provides a quick and easy way to connect to the Microsoft Identity platform and Microsoft Graph. It is built on top of the Graph SDK's authentication providers, but allows usage from XAML.
Add this behavior to your application's main page. It only needs to be added to a single page to bootstrap all the other Graph enabled XAML controls.
Important
Be sure to Register Client Id in Azure first following the guidance here: https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
After finishing the initial registration page, you will also need to add an additional redirect URI. Click on "Add a Redirect URI" and check the "https://login.microsoftonline.com/common/oauth2/nativeclient" checkbox on that page. Then click "Save".
<Interactivity:Interaction.Behaviors>
<providers:InteractiveProviderBehavior ClientId="YOUR_CLIENT_ID_HERE" Scopes="User.Read,User.ReadBasic.All,People.Read,Calendars.Read"/>
</Interactivity:Interaction.Behaviors>
Important
This provider must be initialized in your WPF app when using the XAML Graph controls from XAML Islands. The same syntax above is used; however, you must include the Microsoft.Toolkit.Wpf.Graph.Providers NuGet package instead.
Property | Type | Description |
---|---|---|
ClientId | string | Client Id obtained from Azure registration. |
RedirectUri | string | Client's authentication uri redirect as configured in Azure. |
Scopes | ScopeSet | Comma-delimited list of scopes to pre-authorize from user during authentication. |
Device family | Universal, MinVersion or higher |
---|---|
Namespace | Microsoft.Toolkit.Graph.Providers |
NuGet package | Microsoft.Toolkit.Graph.Controls |