CommunityToolkit / CommunityToolkit/Graph-Controls

MsalProvider uses unknown redirect URI, authentication fails

Open
#188 6 comments 0 reactions 0 assignees View on GitHub
Area: Providers documentation :page_with_curl: question :grey_question:
Dominant language
C#
Stars
156
Forks
38
PR merge metrics
No merged PRs in 30d

Description

## Describe the bug
When using the MsalProvider as documented and as in the sample, auth fails with AADSTS50011.

```
Request Id: 5e464c00-92a4-4a14-a5e6-f6c807527900
Correlation Id: 70fa290d-da9e-4a48-ac59-98da60a73410
Timestamp: 2022-04-29T14:51:55Z
Message: AADSTS50011: The redirect URI 'ms-appx-web://Microsoft.AAD.BrokerPlugin/S-1-15-2-3827128064-569582487-4294593430-3382639814-4294318972-3676523608-2734131615' specified in the request does not match the redirect URIs configured for the application '3892d014-2554-4df7-a10b-9f1e5c0742e7'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.
```

- [ ] Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

## Steps to Reproduce
Steps to reproduce the behavior:
1. Register an app in Azure AD using the redirect URI `https://login.microsoftonline.com/common/oauth2/nativeclient`.
2. Configure your provider.

```csharp
string[] scopes = new string[] { "User.Read" };
ProviderManager.Instance.GlobalProvider =
new MsalProvider("CLIENT_ID", scopes);
```
3. Try to login with the `LoginButton`.

## Expected behavior
Should login

## Environment

```
NuGet Package(s):
CommunityToolkit.Authentication.Msal 7.1.1
CommunityToolkit.Graph.Uwp 7.1.1

Windows 11 Build Number: (10.0; Build 22000)

App min and target version: Windows 10, version 2104 (10.0; Build 20348), Target Windows 11 (10.0; Build 22000)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio
- [ ] 2017 (version: )
- [ ] 2019 (version: )
- [ ] 2019 Preview (version: )
- [x] 2022 (version: 17.1.6)

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.