Skip to content

Instantly share code, notes, and snippets.

@thameera
Created July 25, 2016 09:23
Show Gist options
  • Save thameera/917b06d849b47158c09e67b01100e2a3 to your computer and use it in GitHub Desktop.
Save thameera/917b06d849b47158c09e67b01100e2a3 to your computer and use it in GitHub Desktop.
Auth0 login page with Lock v10
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
html, body { padding: 0; margin: 0; }
.table {
display: table;
position: absolute;
height: 100%;
width: 100%;
background-size:cover;
background-color: #e8ebef;
}
.cell {
display: table-cell;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="table">
<div class="cell">
<div class="content">
<!-- WIDGET -->
<div id="widget-container"></div>
</div>
</div>
</div>
<!--[if IE 8]>
<script src="//cdnjs.cloudflare.com/ajax/libs/ie8/0.2.5/ie8.js"></script>
<![endif]
<!--[if lte IE 9]>
<script src="https://cdn.auth0.com/js/base64.js"></script>
<script src="https://cdn.auth0.com/js/es5-shim.min.js"></script>
<![endif]-->
<script src="https://cdn.auth0.com/js/lock/10.0/lock.min.js"></script>
<script>
// Decode utf8 characters properly
var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@'))));
var initOptions = {
container: 'widget-container',
auth: {
redirectUrl : config.callbackURL,
params : config.internalOptions,
responseType : config.callbackOnLocationHash ? 'token' : 'code',
},
rememberLastLogin: !config.prompt
};
var lock = new Auth0Lock(config.clientID, config.auth0Domain, initOptions);
lock.on("unrecoverable_error", console.log.bind(console));
lock.on("authentication_error", console.log.bind(console));
lock.show();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment