Hi,
The solution you are looking for is not about authentication but authorization.
If I understood correctly, in your solution you have web application secured by the Azure AD B2C. Once the user is authenticated, B2C issues access token which can be used to access your API, correct?
In this case if you want to restrict the access to the Web API only to specific users, you will need to implement authorization mechanism.
You have basically two options here:
- In the access token that is used with your Web API you will add additional claim, like "Role" or "UserType" and than on the Web API side you will validate whether the token has this claim or not. Basing on that you decide whether API returns data or return HTTP 403 status Forbidden.
- You implement authorization on the Web API side fully. It means that you do a verification on the Web API side using user's object ID against authorization system/database to see if this specific user has permission to access your Web API's specific endpoint. It is more complex solution.
Here is the fragment of my video which describes both approaches:
https://youtu.be/sE6fnagYp1M?t=358