API client / Methods / Insights

Get authenticated user token

This method is only available for JavaScript.

Required API Key: any key with the search ACL
Method signature
Only available for JavaScript

We released a new version of the PHP API client in public beta. Read the beta documentation for more information.

About this method # A

Get the authenticated user token from the Insights API Client state.

Use this method to retrieve the authenticatedUserToken provided by you.

Examples # A

1
2
3
4
5
6
7
8
9
10
11
12
// Set the authenticated user token
aa('setAuthenticatedUserToken', 'YourUserID');

// Get the authenticated user token
aa('getAuthenticatedUserToken', {}, (err, authenticatedUserToken) => {
  if (err) {
    console.error(err);
    return;
  }

  console.log(authenticatedUserToken); // 'YourUserID'
});

Parameters # A

Parameter Description
options #
type: object

The options to retrieve the authenticated user token.

This argument isn’t used for now, so you can pass an empty object.

callback #
type: (err: Error, authenticatedUserToken: string) => void

The function called with a possible error and the authenticated user token.

Response # A

This method doesn't return a response.

Did you find this page helpful?
PHP v3