This took me a while to realize.
You need to enter the following URL as one of the redirects for your application authentication.
IMPORTANT NOTE: You will need more than one redirect. One is specifically for the B2C user flow. After that, you can enter whatever you need for your application code.
The first URL you should enter is:
https://your-B2C-tenant-name.b2clogin.com/your-B2C-tenant-name.onmicrosoft.com/oauth2/authresp
And in your case, the second URL you should enter is:
http://localhost:9000/
The order which you add these does NOT matter (in my experience).
So basically the flow looks like this for the user
- User clicks login link in your application (The first link in your post)
- They're taken to the B2C login page (User flow configured in Azure)
- They click "Login with Microsoft" (or whatever provider you've chosen). Note, if the Entra ID provider is the only one applicable, they will skip this step entirely and be led to step 4
- User is taken to the Microsoft login page (The second link in your post).
- Upon successful login, they will be redirected to the B2C URL (similar to the one in step 2)
- If there aren't any issues, the B2C URL redirects back to your application with the auth code