Azure / Azure/static-web-apps

Request to a custom role endpoint contains a malformed JSON string in the body

Open
#768 5 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

**Describe the bug**

We've followed the guidance of this tutorial: https://docs.microsoft.com/en-us/azure/static-web-apps/assign-roles-microsoft-graph in order to create a custom endpoint for fetching roles for a user upon login.

The issue we're facing is that the request body sent the custom roles endpoint is not complete. It's cut midway through the `accessToken` value, and thus it's an invalid JSON string and missing data.

In our setup we use "Bring your own functions" and an Azure Functions App as a proxy. The proxy forwards the roles request to our backend server, but I have verified that this same issue is present also when using a HTTP triggered Azure Function (without a proxy) as the endpoint.

The auth section of our staticwebapp.config.json looks like this:

```
{
...,
"auth": {
"rolesSource": "/api/getRoles",
"identityProviders": {
"azureActiveDirectory": {
"userDetailsClaim": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"registration": {
"openIdIssuer": "https://login.microsoftonline.com/{...}",
"clientIdSettingName": "{...}",
"clientSecretSettingName": "{...}"
},
"login": {
"loginParameters": [
"resource=https://graph.microsoft.com"
]
}
}
}
}
}
```

**Expected behavior**
Expected the body to contain user data in a valid JSON string.

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.