Connecting to Azure Web App API from SpFx is throwing 403.76 error

Amal Hashim 0 Reputation points
2024-05-08T03:19:28.51+00:00

I have deployed a simple Web API project with weatherforecast controller in it.

  • There is no Authorization code in the API.
  • Deployed the API to Azure Web App. Tested the endpoint https://xxxx.azurewebsites.net/weatherforecast and it worked fine.
  • Created a spfx webpart and connected to the API - worked fine
  • Enabled Authentication in App Service
    • Added API permission - user_impersonation, User.Read
    • Granted Admin Consent
  • Updated spfx to use AadHttpClient
    • Added webApi permission request in package-solution
  • Deployed sppkg
  • Approved in SharePoint Admin center -> API permission

When the webpart is added to a page - it tries to connect to the API and it results in 403 error.

I can see the Bearer token in the request and use JWT decoder - it all looks good

Checked API logs and found 403.76 error code.

Any idea on how to resolve this?

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,702 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,988 questions
{count} votes