Web: Custom Login Page - gecko-8/devwiki GitHub Wiki

Up

This method uses the Auth0.js library and Implicit Grant. It requires an Audience to receive a JWT token. You can setup a custom Audience by following this guide: Custom Audience Guide

  1. Install/include the Auth0.js library
    npm install auth0.js
    or
    <script src="https://cdn.auth0.com/js/auth0/9.11/auth0.min.js"></script>
  2. In your login handler add code similar to
    var webAuth = new auth0.WebAuth({
      domain:       '<Auth0 tenant domain>',
      clientID:     '<Auth0 client Id>'
    });
    
    const result = webAuth.login({
      email: '<account email address>',
      password: '<account password',
      realm: 'Username-Password-Authentication',  // Should match the Connection of the user in Auth0
      responseType: 'token',
      redirectUri: 'http://localhost:5000',       // Url of your site it should redirect back to after login
      audience: 'http://mktfy.com'                // Should match the API Audience of the custom API you setup in Auth0 (represents API the token will be used with)
    });
    
⚠️ **GitHub.com Fallback** ⚠️