Auth0 Home Blog Docs

Can't get universal login to work

So I have an angular 7 client using Auth0. Till now I’ve used the standard embedded login. Right now I have the auth.Login() method in my navbar. My callback URL are just my homepage at localhost/4200. It works, I’m getting redirected back and I’m now authenticated. So now I’d change from auth.Login() to an href with a direct link to the universal login from the dashboard at: https://{YourDomain}.auth0.com/login?client={ClientID}

I am still visiting my login page and able to login if provided correct credentials. Even so, after the login I am redirected back to my homepage but with an URL of “http://localhost:4200/items?code=zP2Ve9_OaiXJjTuP&state=tcz0Ho-4Bpb-t~sQrvsls88yS8c2DNh9” instead of localhost:4200/items (= localhost:4200). I am also not authenticated. What are this code and state messages and what am I doing wrong? I’ve changed nothing but the one URL which should seemingly do the rest itself.

Hi @ShoeyAuthor,

From the looks of it, you are redirecting directly to the /login endpoint. Instead, you should be calling the /authorize endpoint with all the required parameters, which in turn will automatically perform the redirect to the /login page. This is outlined in the API documentation.

If you are using Auth0.js, you could use the authorize() method, which might be easier to implement.