Using AE JS and the AE API to Register Users

AE JS is used to present social login options to users, and then take users through the full registration and/or login flow. While we offer a built-in widget for registration and login, you can also choose to create a completely custom registration flow using AE JS and the AE API.

User Registration Flow

Normally, our registration flow looks like this:

  1. The user chooses a social service that they want to use as their login.
  2. AE JS directs the user to the authentication form for the chosen service.
  3. The authentication form is submitted and AE creates a new user record.
  4. The user is logged in.
  5. A valid AE user session is now active in the browser, which is an object that can be queried with aeJS.user .

The User Object and AccessTokens

Once the user has registered, a user session is now active in the browser. You can query the user object using aeJS.user.

If you want to validate the user authentication on the server, you can use the user object's AccessToken. Then, you can log the user into your website.

For the login process, you can take the user details from the aeJS.user object. However, using the AccessToken is a more secure approach. We recommend taking the AccessToken during the login process and making an auth  API call to get the user details. This creates an extra roundtrip to the server—but the resulting user details are accurate and cannot be tampered with from the client-side.

How did we do?