
Setup your application's code
<!-- Auth0Lock script -->
<script src="https://cdn.auth0.com/js/lock/11.3.0/lock.min.js"></script>
<!-- Setting the right viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
Add the following lines to your base code
var userProfile;
var userToken = localStorage.getItem('userToken');
var accessToken = localStorage.getItem('accessToken');
lock.on('authenticated', function(authResult) {
lock.getUserInfo(authResult.accessToken, function(error, profile) {
if (error) {
// Handle error
return;
}
localStorage.setItem('userToken', authResult.idToken);
localStorage.setItem('accessToken', authResult.accessToken);
userProfile = profile;
userToken = authResult.idToken;
});
});
if (userToken && accessToken) {
lock.getUserInfo(accessToken, function (err, profile) {
if (err) {
return alert('There was an error getting the profile: ' + err.message);
}
userProfile = profile;
});
}
$('#login button').click(function(e){
e.preventDefault();
lock.show();
});
Create an Application in Auth0 dashboard

Create

GET STARTED IN MINUTES
Authentication Built for Security & High Availability
Auth0 is the easiest way for developers to integrate enterprise-grade authentication and identity management to any app.
Industry Standard Compliance
SOC 2, HIPAA/BAA, EU/US Privacy Shield Framework, Open ID Certified.
Learn MoreBuilt by Security Experts
Continuously reviewed and tested by external security experts. Strong password encryption and hashing algorithms, at rest and in transit.
Learn MoreWhat Our Customers Say

Continuously reviewed and tested by external security experts. Strong password encryption and hashing algorithms, at rest and in transit.
Learn MoreGet Auth0 free for 7,000 active users per month with unlimited logins
- Single Sign On
- Passwordless Login
- Up to 2 Social Identity Providers
- Multifactor Authentication
- User Management
- Extensibility (Run custom code on Auth)