Resolving Base Url of Ad B2c user register flow.

Rohit Mishra 20 Reputation points
2024-01-18T05:52:25.2133333+00:00

WARNING! There was an error parsing the document

Hello, I  have created a User register flow in azure AD B2C, and when running that flow it redirects me to my localhost with access_token & all. But in in url I am getting "#" instead of "?".  So I want suggestions how to resolve this.
Below I am attaching few Screen Shots.  
**ss1.  Register flow**  
![User's image](/api/attachments/990f3318-566b-42ee-b46e-652e7014ba4f?platform=QnA)

  
 **ss2. Url contains "#" instead "?".**  
In the below image in URL after sign-in I want "?" instead  "#".  
  
![User's image](/api/attachments/0bbb8233-b4f6-4063-b03a-99fa32c867b2?platform=QnA)

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Alfredo Revilla - Upwork Top Talent | IAM SWE SWA 27,526 Reputation points Moderator
    2024-01-19T19:37:19.2333333+00:00

    Hello @Deepanshu katara , by default Single-page application sign-in using the OAuth 2.0 implicit flow in Azure Active Directory B2C will follow the response_mode=fragment query parameter and use # as response delimiter. If you want to use ? as response delimiter you need to set the response_mode query parameter to query. Eg.

    GET https://{tenant}.b2clogin.com/{tenant}.onmicrosoft.com/{policy}/oauth2/v2.0/authorize?
    client_id=90c0fe63-bcf2-44d5-8fb7-b8bbc0b29dc6
    &response_type=id_token+token
    &redirect_uri=https%3A%2F%2Faadb2cplayground.azurewebsites.net%2F
    &response_mode=query &scope=openid%20offline_access &state=arbitrary_data_you_can_receive_in_the_response
    &nonce=12345
    

    This also applies to the way you want to delimit the OAuth 2.0 authorization code flow in Azure Active Directory B2C response as documented in Get an authorization code.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Deepanshu katara 16,720 Reputation points MVP Moderator
    2024-01-18T06:00:44.3066667+00:00

    Hi Rohit , As a pre-requisite for using a B2C User Flow, you'll need to Register a web application in Azure Active Directory B2C and Enable ID token implicit grant. Once you've created your application, you can go back to your user flow, select the application, reply URL, and run the flow. Below Img for ref User's image

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.