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
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.
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:
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.