question

kdeman-8994 avatar image
0 Votes"
kdeman-8994 asked kareldeman-4746 commented

How to configure my Azure Function API with OAuth2 to work with B2C SignIn

I have followed instructions on how to secure my API to be called from B2C Signup using OAuth2 bearer authentication. However, these instructions only outline the configuration in the custom b2c policy, but not how to configure my API itself to accept calls from B2C.

If I don't enable authentication on my API, the calls happen fine and the SignIn works perfectly. However when I enable Authentication, I get an error whilst executing the SignIn.

The error is AADB2C90027: Basic credentials specified for 'REST-GetProfile' are invalid. Check that the. Credentials are correct and that access has been granted by the resource'

Are there instructions to configure the API Authentication for this scenario?

azure-functionsazure-ad-b2c
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @kdeman-8994 Could you share the guide you are following so I can understand how your B2C configuration is setup? Also, for the function app, are you setting the authentication up on the App Service Account/in the portal, or are you trying to authenticate users within the function code?

0 Votes 0 ·

I am following this documentation secure-rest-api. I would like to setup Authentication up on the App Service/Account in the portal, not in function code. So basically I want to understand how to configure the actual API (function app in my case) when following the documentation.

Note I also have another (same) question I asked on stackoverflow here how-to-get-custom-b2c-policy-to-send-a-oauth2-bearer-token-to-my-custom-signup - as I still can't get the documentation steps to work.

Many thanks in advance!

0 Votes 0 ·

0 Answers