Token storage location

memesaregood3 months ago

What table are the user tokens held in? Are they stored in the DB?

Anton Tananaev3 months ago

They are not stored anywhere.

memesaregood3 months ago

Does this mean that they are rendered invalid each time an instance is restarted?

Anton Tananaev3 months ago

No.

memesaregood3 months ago

If they are not stored anywhere, and yet they're still valid after a server restart, that means they're stored somewhere else? Where? How are they kept persistant?

Anton Tananaev3 months ago

They are not stored anywhere.

Kalabint3 months ago

Hi,

The tokens are signed JSONs containing:

  • userId
  • expiration date

If you don't give any date at creation they will be 7 Days valid.
They are signed with a key stored in the Traccar DB (tc_keystore table), so only the key pair appears in the database.

This is how tokens remain valid despite server restarts.

For full implementation details see this folder in the source code of Traccar.

memesaregood3 months ago

Hi, thank you for the info!