Created
December 2, 2023 00:01
-
-
Save nicosabena/0690c120e7d583cd299b7c1de87007c4 to your computer and use it in GitHub Desktop.
Auth0 "classic" hosted login page that takes the user to a specific connection to authenticate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Sign In with Auth0</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
</head> | |
<body> | |
<script> | |
// bypasses the login screen and takes the user | |
// directly to a specific connection to authenticate | |
const CONNECTION_NAME = "google-oauth2"; | |
window.addEventListener('load', function() { | |
var config = JSON.parse( | |
decodeURIComponent(escape(window.atob('@@config@@'))) | |
); | |
delete config.internalOptions.protocol; | |
delete config.internalOptions._intstate; | |
const urlParams = new URLSearchParams( | |
Object.assign({ | |
client_id:config.clientID, | |
response_type: 'code', | |
redirect_uri:config.callbackURL, | |
connection: CONNECTION_NAME, | |
}, config.internalOptions) | |
); | |
const redirectUrl = `https://${config.auth0Domain}/authorize?` + urlParams.toString(); | |
window.location = redirectUrl; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment