skip to Main Content

I have setup Azure B2C with custom user flows, all works fine from my SPA application. However, I have a landing page which is not part of the SPA application and I want to add login and signup links.

Is there a link that I can use and where can I find it?

2

Answers


  1. B2C does not support native API for auth.

    There is no specific endpoint to get the login screen.

    The only way to do this is to use the string that appears under "Run now endpoint" in the policy.

    i.e. the OIDC flow.

    Login or Signup to reply.
  2. If you only have that one application, you could link to the SPA and have routes in there that trigger automated login/signup when accessed.

    So the flow would be:

    1. User clicks link in landing page to login
    2. User is redirected to spa-url.com/login
    3. SPA uses MSAL.js to perform login immediately
    4. User is redirected to log in through AAD B2C
    5. User logs in
    6. User is redirected to SPA, user is now logged in

    And similarly for sign up.

    The reason we would want to go through the SPA is that even if you make the user logged in through the landing page, they won’t be considered logged in to the SPA yet at that point.
    Authentication must start and end in the same place.
    Of course if your SPA always auto-redirects to login, this is less of a problem as that would take care of itself.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search