Azure Function Configuration for B2C SPA APIM Tutorial

hampton123 1,175 Reputation points
2023-08-03T15:51:24.9033333+00:00

I am following a Microsoft tutorial for integrating B2C with a single-page application (SPA) in Azure API Management (APIM). However, as a beginner, I am encountering issues with integrating Azure Function with my API while configuring authentication settings.

Whenever I run a test with identity provider-based authentication settings in Azure Function, it returns a 500 Internal Server error, and the SPA returns the same error once I try to call the API. On the other hand, when I remove the authentication settings from Azure Function, it returns the desired message when running a test on the Azure Function itself. However, when I try calling the Azure Function through the Call API button on the SPA, I receive a 400 error.

I'm unsure what the issue is, but I suspect it has to do with Azure Function authentication. Could someone guide me on how to fix this?

Edit: Also I was wondering if maybe there are some permissions in the tokens that might be causing this issue? For example, maybe the account I'm using doesn't have the permissions to access the API?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,364 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,673 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
3,130 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,195 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mike Urnun 9,856 Reputation points Microsoft Employee
    2023-08-07T15:46:26.1166667+00:00

    There was a mismatch between the Function app name in the msal config vs the actual Function App name; and the issue was resolved in the following thread: https://learn.microsoft.com/en-us/answers/questions/1339396/does-the-azure-function-coding-language-matter-for

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.