Validity of a token created by api

Hi,

I have an issue with the validity of tokens generated through the api.

I’m creating api tokens with the javascript client method addApiKey. I want the token to last 1 day, so I set the params validity as 86400 (seconds).

When I check the token in the interface at this page https://www.algolia.com/apps/XXXX/api-keys/restricted, all my tokens are marked as

Valid until: January 2nd 1970, at 00:54 (Unix timestamp 86047)

The token is usable, so I assume it’s just an issue with the interface.

Is there a way to know when the token will really be invalid ?

Thanks a lot

Hi Pierre,

To help us, can you tell us:

  • what API client and version you are using
  • a code snippet of how you configured your api key.

Thanks !

Hi Sophie,

Thanks for your fast answer.

I’m currently using the version 3.32.1of the javascript version (installed from npm).

const client = algoliasearch(id, key);
client.addApiKey(acls, { validity: 86400 }, (error, content) => {
  waitForKey(content.key, Date.now(), client).then(() => doSomething)
});

I removed params like the description or indexes for clarity :slight_smile:

Hi Pierre

It seems like it’s a display issue on the dashboard side indeed.

Sorry about that!

We will work on fixing that.

Hi Vincent,

No trouble, thanks for your help.

Hav a good day.

Hi @pierre.boutbel, the issue should be resolved now – can you confirm?

Hi,

I confirm it’s now displaying the real date.

Thanks a lot for the fix !

Have a great day.

1 Like