🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
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.

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

You’re currently reading the Ruby API client v2 documentation. Check the migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.

About this method

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

Use this method to retrieve the authenticatedUserToken provided by you.

Examples

Read the Algolia CLI documentation for more information.

For more information about initializing the Insights client aa, see Initialize the Insights client.

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

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

This method doesn't return a response.

Did you find this page helpful?