Skip to main content
Keep your sk-at- key on your server. A browser token is bound to one signed-in app user, lasts 15 minutes by default (one hour maximum), and is read-only for memory unless you choose otherwise. A phone app uses the same token route. Store tokens in memory, and revoke them on logout. A stolen token can act as that user until it expires or is revoked.

Mint in a signed-in server route

Your authentication layer must return your own stable user id. The route below is shaped like a Next.js route handler. It sends only the options you set and tells the browser when to refresh. Do not cache its response.
For Python servers, use the same signed-in user id:
Send Cache-Control: no-store on your Python response too. AsyncAtlaso has the same methods with await.

Call from the browser

The SDK refreshes a function-supplied token after 80% of its reported lifetime. If the gateway says browser_token_invalid, it fetches a fresh token and retries that request once. A fixed token string cannot refresh.
atlaso.memory.list() reads this token’s user; do not call forUser() in token mode. Read-only tokens cannot add or delete facts. Erasure and token management stay on your server. On logout, call atlaso.forUser(userId).revokeBrowserTokens() on the server, or atlaso.revokeBrowserToken(tokenId) for one token. Do not send your sk-at- key to a phone or web worker.