Azure B2C: Access to Web API not working (401 Unauthorized)

ManuBera 21 Reputation points
2022-11-21T11:45:23.343+00:00

Dear Azure community,

I have a really hard time figuring out how to obtain access for a user to my Web API that is registered on a B2C tenant.

I use the ROPC policy, because it has to work without browser interaction, just with username and password. I managed to get an access token that I send in the header of my requests to the Web API, but I only get back "401 Unauthorized" no matter what I try.

Of course I'm aware that it is nearly impossible to find a solution without knowledge about my code and configuration and I also formulated a question containing more detailes to my problem on Stackoverflow (https://stackoverflow.com/questions/74479164/asp-net-core-web-api-azure-unauthenticated-error-access-token-in-header)

What reasons could there be that my access token is not accepted by the authorization? What reasons could there be that the access token is not valid? I really don't know what to try anymore :(

Any help on this would be highly appreciated! Thank you!

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
827 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.
2,752 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,443 questions
{count} votes

Accepted answer
  1. Shweta Mathur 29,341 Reputation points Microsoft Employee
    2022-11-22T12:30:48.73+00:00

    Hi @ManuBera ,

    Thanks for reaching out.

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!
    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer so it will help others in community looking for similar issue.

    263050-image.png

    Thanks,
    Shweta

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful