Calling API with bearer token not working

Richard 11 Reputation points
2021-03-19T22:39:45.033+00:00

I have an API which I can call locally using a bearer token and Postman.

I can also call the API on Azure, when authentication is switched off.

However, when I switch authentication on, try to call it with a token, I receive the following error:
"The page cannot be displayed because an internal server error has occurred."

The status in Postman says "500: Unable to download OpenID Connect Configuration"

I also tried adding the authorize attribute above one route on the controller, and created another route which just returns the string "hello"; I left this route open, not requiring authentication.
Again, I can access this without authentication locally, but as soon as it's deployed to Azure, I get this same error as above.

I suspect there is something I haven't set up correctly in Azure but I can't figure it out.
I'm also not seeing anything in App Insights. Not sure if I should be able to.

Any pointers will be greatly appreciated

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,617 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Patrick Galbraith 6 Reputation points
    2021-05-13T00:50:55.15+00:00

    I had the same issue when calling a function app. It was caused by the issuer URL being incorrect in the Authentication configuration. In my case it needed to be "<authentication-endpoint>/<tenant-id>/v2.0".

    1 person found this answer helpful.
    0 comments No comments