With the object reference to Auth available from the previous article, you can now use it to launch the screen where your users login, register or recover their password. In the following example, the code is executed after the user clicks the login button.
<button id="loginBtn">Login</button>
<script type="text/javascript">
document.getElementById('loginBtn').addEventListener('click', function(e) {
auth.authorize().then(
function() {}, // success
function() {} // cancel or failure
);
});
</script>
If you see an error message in the popup window, this is the first place the Allowed Origins you configured in the client are checked. Make sure you’ve allowed the current host name you’re testing on.