dotnet / dotnet/aspnetcore

AADB2C99068: Scope parameter must be formatted like https://<application-uri>/.default

Open
#56,311 0 comments 1 reaction 0 assignees View on GitHub
area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

> System.Exception : An error occurred while attempting to acquire a token. See the inner exception for detail.
----> Microsoft.Identity.Client.MsalServiceException : AADB2C99068: Scope parameter (https://MyDomain.onmicrosoft.com/555-212762d209fe/access_as_user) must be formatted like https:///.default
Correlation ID: 2048500c-056e-40a6-8157-145f9b4b423e
Timestamp: 2024-06-19 03:33:00Z

Config:

"AzureADB2C": {

// ...
"Scopes": ["https://MyDomain.onmicrosoft.com/555-212762d209fe/access_as_user"]


Google search for error AADB2C99068 returns:

Replacing the scope name with a .default as suggested by the error results in 403 error.

"https://MyDomain.onmicrosoft.com/555-212762d209fe/.default // 403


From the examples found [here](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/master/4-WebApp-your-API/4-2-B2C/Client/appsettings.json):

"TodoListScope": "https://fabrikamb2c.onmicrosoft.com/tasks/access_as_user",

This example works and the scope is formatted as expected. Why do I get the error shown in the title?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.