Hi!
I need to use the SSO of Auth0 but with a custom login, for that I am using Auth0.js. I have already configured my custom domain and I am calling the webAuth.login() method.
But after the redirect i still get the Auth0 Universal Login page.
I check the logs and it appears “Success Cross Origin Authentication”, so I don’t know if i need to do something else to skip the universal login page.
I have this:
var params= {
domain:"mydomain.auth0.com",
clientID: "miclientid",
redirectUri: "REDIRECT_URL",
audience: "https://mydomain.auth0.com/userinfo",
responseType: "token id_token code",
scope: "openid profile app_metadata offline_access email"
}
var webAuth = new auth0.WebAuth(params);
var login_options ={
realm: "db_connection",
username: username,
password: password,
nonce: createNonce(16),
state: JSON.stringify({ redirectUrl: REDIRECT_URL })
}
webAuth.login(login_options, function(err, data) {
if (err) alert(err);
else{
//some_code
handleAuthentication(data);
}
});
function handleAuthentication(data) {
webAuth.parseHash(function(err, authResult) {
if (data && data.accessToken && data.idToken) {
let expiresAt = JSON.stringify(data.expiresIn * 1000 + new Date().getTime())
localStorage.setItem('access_token', data.accessToken);
localStorage.setItem('id_token', data.idToken);
localStorage.setItem("expires_at", expiresAt);
console.log('parseHash complete')
} else if (err) {
console.log(err);
alert('Authentication failed');
}
});
}
and later when it goes to REDIRECT_URL it shows the universal login page