Azure AD B2C Login Problems

Viewed 1927

I am trying out the sample code on GitHub called active-directory-b2c-dotnet-webapp-and-webapi and when I run it against the AD B2C directory in the sample it works fine but I'm having an issue trying it out against my own AD B2C directory. I get the following error:

The application with ID 'xxx' cannot get an ID token either because the openid scope was not requested or the application is not authorized for it

Isn't the openid scope included automatically? I setup a Web App and a Web API app as per the instructions provided. When I look at the scopes that the Web App has access to, the openid scope is not listed there. Is this something I need to add manually?

4 Answers

In addition to the openID step outlined above, also do the below:

Go to the API access under the Application in B2C for the app in question and add a permission against this same app saying "access this app on behalf of the signed in user".

No other steps needed.

I found the issue was with app registrations > API Permissions. When adding permissions in the Request API permissions screen, make sure you select "Delegated permissions: Your application needs to access the API as the signed-in user."

If you selected the other option, then recreate your configuration and try again.

Related