@mobicycle are you setting up Auth0 for the first time? You shouldn’t be calling
/login
directly. If you’re using Lock 11 for Web, first step is to install Lock (any of these installation sources will be fine so choose whichever you are more comfortable using). Then configure cross-origin authentication as described here. Next, we will begin initializing Lock as described here which describes creating a Lock object like:
var lock = new Auth0Lock(
'CLIENT_ID',
'<TENANT-NAME>.auth0.com'
);
Then we need to listen for an authentication event by implementing the on
method for Lock:
lock.on("authenticated", function(authResult) {
// implement here what you want to happen upon authentication
...
if (error) {
// Handle error
return;
}
...
});
});
Lastly, we can add a listener to the Log in
button, example the button ID is btn-login
:
document.getElementById('btn-login').addEventListener('click', function() {
lock.show();
});
This will launch the Lock widget after the user clicks a login button.