Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check is the user is already authenticated on other site.
window.onload = function() {
webAuth = new auth0.WebAuth({
domain: 'saltuk-wordpress.auth0.com',
redirectUri: 'http://dev-auth0-test1.pantheonsite.io/index.php?auth0=1',
clientID: 'SCNHLB4vHvQlTKazudZO87LDikCyrP6s',
responseType: 'token id_token',
});
if (document.cookie.match(/^(.*;)?\s*CheckedSessionCookie\s*=\s*[^;]+(.*)?$/) === null) {
webAuth.checkSession({}, function (err, result){
if (!err) {
// There is a valid session from another app so let's redirect after setting the
// session state checked cookie to prevent a redirect loop
document.cookie="CheckedSessionCookie=true";
location.href='http://dev-auth0-test1.pantheonsite.io/wp-login.php/';
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.