How to check if searchClient is successful created? [jacascript

Hey there,
I’m building an Algolia plugin for the Strapi framework and I was wondering how to check if the client has the right credentials/APIkey? Even with no indices initiated or any objects added.

const algoliasearch = require("algoliasearch");

const client = algoliasearch("YourApplicationID", "YourAdminAPIKey");

Anyone any suggestion?

Super cool project! You can always call getApiKey with the key itself to get information about the current key.

const appId = '';
const apiKey = '';
algoliasearch(appId, apiKey).getApiKey(apiKey).then(console.log);

To check if the key has the right access you should check acl but also if it has index restrictions.

1 Like

Thanks @Jerska I’ll try that when I have some time.