Azure / Azure/static-web-apps

401 on callback after login with multitenant application

Open
#1,544 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Hi I am trying to configure authentication for my Static Web Application using a multi-tenant app registration.

The authentication flow seems to complete but results in a 401 during the final request for the callback endpoint.

My configuration works when using "https://login.microsoftonline.com//v2.0" but fails when using "https://login.microsoftonline.com/organizations/v2.0".

I have tried adding routing rules to explicitly allow access to the callback endpoint and fiddling with various configurations of my app registration and application config but to no avail.

Is there a lack of support for multi-tenant flows or am i doing something wrong?

My config is as follows:

```
{
"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": {
"openIdIssuer": "https://login.microsoftonline.com/organizations/v2.0",
"clientIdSettingName": "AZURE_CLIENT_ID",
"clientSecretSettingName": "AZURE_CLIENT_SECRET"
}
}
}
},
"routes": [
{
"route": "/.auth/*",
"allowedRoles": ["anonymous"]
},
{
"route": "/test*",
"allowedRoles": ["authenticated"]
}
],
"responseOverrides": {
"401": {
"statusCode": 302,
"redirect": "/.auth/login/aad"
}
}
}

```

And then authentication settings on the app registrations are as follows:
![Screenshot 2024-09-13 095053](https://github.com/user-attachments/assets/68d23001-bea3-4d0c-837d-113b58b611fd)

![Screenshot 2024-09-13 095104](https://github.com/user-attachments/assets/38a70740-f007-4330-9f6f-36aeb2456a90)

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.