Azure B2C .net demo issues


  • Hi,

    I'm following the demo guide here:

    I have setup the components detailed in the document.

    I have setup the application as detailed here:, but there is little information related to the expected Published Scopes required for the application.

    I have then proceeded through the TaskService article:

    Sign in via local account and Windows account works fine. However, if I try to look at the to-do-list, I get a null exception error in TaskController.cs

    Scopes are currently setup as follows (I have tried a few iterations):

    B2C policies are setup to use the endpoint of the app created for the task service, e.g. the signin policy:

    Please help me to resolve this issue. Let me know if you need any further information.



    Thursday, April 27, 2017 11:06 AM

All replies

  • In order to make the scopes work, you need to make sure:

    You use the correct ApiIdentifier

    1. Define the scopes
    2. Grant the scopes(permission) to you app
    3. As mention above, first make sure you use the correct ApiIdentifier in TaskWebApp's web.config is equal to the one defined in B2C app settings.

    Second, as you already done, define the permissions (scopes) that can be granted to other applications

    Last, grant permission to your app - I think this is the missing part in your case

    Sunday, May 7, 2017 8:49 AM
  • Yoel,

    Many thanks for your response, sorry for the delay in replying.

    I made the changes to the API Access panel and all other components are in place, but I still see the same error.

    However, I note that my web app has two reply URL's. I believe that I added both as I used the same app for both the TaskService and TaskWebAPI.

    This weekend, I will start with a clean slate, recreating the apps, with one app for each component.

    I'll let you know if this resolves the issue.



    Wednesday, May 10, 2017 9:58 PM
  • Yoel,

    I finally got some time to revisit this, but am no further forward.

    The web service web.config file is setup as described:

    The task service web.config is:

    With the Azure app settings as follows:

    Application configuration:

    API Access:

    And finally, scopes:

    Looking back over the documentation, it is not clear if one or two Azure Applications need to be created - I have only one.

    If I remove the Task Service end point (https://localhost:44332) from the Azure Application, then the application runs just fine, but with no link to the to-do-list.

    When the Task Service end point is present, then the application runs fine, I can login using any of my chosen providers. However, if I choose the to-do-list, I see the same error as before.

    I noted that the to-do list url was https://localhost:44316/Tasks, so I made a change to my Azure application and to the web.config file to make it match your example:

    <add key="api:ApiIdentifier" value="" />

    However, this made no difference either - I still see the same null reference error when clicking on the to-do-list.

    Hope you can help me to troubleshoot this some more.



    Tuesday, June 6, 2017 11:08 AM
  • Hi Jon,

    Could you share an example of the JWT token? Or the URL of your web site is better, then I'll be able to check the input and output. If you prefer, you can send me direct message on Facebook


    Monday, June 12, 2017 11:44 AM