Custom Authentication - Multitenant organization registration
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
We are investigating porting an in-house application to Static Web Apps as a POC. The application currently uses Azure Functions and a storage hosted React SPA, with MSAL used for authentication. The application uses 2 application IDs, one for the function app and one for the frontend. The applications are set to produce v2 tokens using the manifest.
In the original application, the function app is set to have a blank issuer URL as it is multi-tenant (validation happens in the application).

Porting the frontend to SWA works fine, as does calling the original function app from the code. When deploying a BYOF function app and linking, I'm not able to call the backend from the same origin.
**To Reproduce**
Trying to port this to static web apps, in staticwebapp.config.json:
```
"routes": [
{
"route": "/api/*",
"allowedRoles": ["authenticated"]
},
"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": {
"openIdIssuer": "",
"clientIdSettingName": "AAD_CLIENT_ID",
"clientSecretSettingName": "AAD_CLIENT_SECRET"
}
```
A token is acquired in the application for the frontend app with a scope for the backend API. A fetch call to `/api/` receives a 401 in the application.
**Expected behavior**
I would expect that as the application multi-tenant then in the backend a combination of either lack of openIdIssuer or a blank string would result in validateIssuer being set to false, but this does not seem to work. The documentation at [Custom Auth](https://docs.microsoft.com/en-us/azure/static-web-apps/authentication-custom?tabs=aad) only mentions including the tenant ID, but for a multitenant app the issuer will be the source domain of the user.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.