Azure / Azure/static-web-apps

401 Unauthorized on a linked function app HttpTrigger, authLevel=function

Open
#614 5 comments 3 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**

I have a linked function app to a SWA. This works great. I set the `authLevel` to `anonymous` and it works perfectly with the SWA.

But now I want to add some other triggers than just the SWA. For example responding to a Zapier webhook.
So I create a new function with a HttpTrigger and sets the `authLevel` to `function`. But when testing (from Postman) I only get 401 unauthorized when I provide the auth key. Both function key and host key.

**Expected behavior**
Be able to use function access keys on functions that are marked as access level function from outside of the SWA, when I have an identity provider set up.

**Context**
Am I supposed to be able to access other functions in a function app when the app is linked to a SWA?

Here: https://docs.microsoft.com/en-us/azure/static-web-apps/functions-bring-your-own#security-constraints
it says that if I have not set up a security provider the Static Web App has exclusive access to my API.

I set up an Azure AD provider but still could not use the functions with function keys.

I know that function keys is not the most secure way of auth, but for some integrations I have no choice.

Or is the intended way this is supposed to work is that I set up a stand alone function app and then create managed functions in the SWA to proxy the functions I need to call in the SWA.

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.