Hi,
I’m working with a Power Pages SPA / code site and I’m trying to set up local development with Web API calls from localhost, following this documentation:
https://learn.microsoft.com/en-us/power-pages/configure/create-code-sites#set-up-local-development-by-enabling-web-api-calls-from-localhost-using-microsoft-entra-id-authentication
The setup works correctly when the authentication provider is the standard Microsoft Entra ID provider. I can call the Power Pages Web API from localhost using:
Authorization: Bearer <id_token>
However, after switching the site authentication provider to Microsoft Entra External ID, the same local Web API calls return:
403 Forbidden
The API works correctly after deploying the SPA to Power Pages, so table permissions, web roles, and the Web API configuration seem to be correct. The problem appears only when calling /_api from localhost with a bearer token.
My current site settings include an External ID provider with the provider key:
Authentication/OpenIdConnect/EntraExternalID_1/...
I tried the following bearer authentication configuration:
Authentication/BearerAuthentication/Enabled = true
Authentication/BearerAuthentication/Protocol = OpenIdConnect
Authentication/BearerAuthentication/Provider = EntraExternalID_1
I also tried other provider values, including:
Authentication/BearerAuthentication/Provider = AzureAD
Authentication/BearerAuthentication/Provider = EntraExternalID
but the result is still 403 Forbidden.
I also tested Authentication/BearerAuthentication/ValidIssuers.
Its claims look like this, with tenant-specific values masked:
{
"aud": "<external-id-app-client-id>",
"iss": "https://<external-tenant-id>.ciamlogin.com/<external-tenant-id>/",
"name": "<user-display-name>",
"tid": "<external-tenant-id>",
"unique_name": "<user-external-email-address>",
"upn": "<external-user-object-id>@<external-tenant-name>.onmicrosoft.com",
"ver": "1.0",
"email": "<user-external-email-address>",
"given_name": "<user-first-name>",
"family_name": "<user-last-name>"
}
The aud value matches the client ID configured for the Power Pages External ID provider.
The OIDC metadata endpoint configured for the provider returns an issuer like this:
{
"issuer": "https://<tenant-id>.ciamlogin.com/<tenant-id>/v2.0"
}
I noticed that the issuer in the token does not include /v2.0, while the metadata issuer does. I also tried setting ValidIssuers to the exact iss value from the token, but the local Web API call still returns 403.
My questions are:
- Is bearer authentication for local Power Pages SPA Web API calls supported with Microsoft Entra External ID, or is this local development flow supported only for the standard Microsoft Entra ID /
AzureAD provider?
- What should the correct value of
Authentication/BearerAuthentication/Provider be for an External ID provider: EntraExternalID_1, AzureAD, EntraExternalID, or something else?
- Should
Authentication/BearerAuthentication/UseEntraV2Issuer be enabled for Microsoft Entra External ID in this scenario, even when the ID token has "ver": "1.0"?
- How should
ValidIssuers be configured when the token issuer and metadata issuer differ by /v2.0?
- Is there any additional site setting required to allow localhost bearer-authenticated Web API calls when using Entra External ID?
Any guidance or a working configuration example for Power Pages SPA local development with Microsoft Entra External ID would be appreciated.
Thanks!