Accessing User Data with AE JS

Access to user data can be handled in a few ways. It is dependent on settings in your AE Connect authentication flow configuration.

To return all of the current user's data, use the aeJS.get.user method. 

auth_window = true

In cases where your aeJS.settings['auth_window'] is true, the user data can be accessed in the JavaScript layer. 

If the user session already exists, a user object is available as part of the aeJS object. 

The user object will also be broadcast across any onLogin or onUser event handlers. See our AE JS Events Reference documentation for more information.

auth_window = false

In cases where aeJS.settings['auth_window'] is false, the user data can be accessed in the JavaScript layer. This is no different than if the auth_window setting had been set to true. However, when the auth_window setting is set to false, the user is redirected to another URL for authentication with a social network.

Once the user has been authenticated and is sent to the return URL, you can use the provided accesstoken to access to their user data. The accesstoken can be used to make an auth call to the AE REST API and return required user data.

Secure Calls to the AE API

Note that all of your calls to the AE REST API should be made via server-side code.

We recommend that this code run on a local machine with its IP whitelisted from your AE dashboard.


How did we do?