Skip to content

Authentication and sessions

Token and session security

Where RemiliaNET tokens and client secrets belong, how access tokens expire, and what logout and revocation change.

Your app holds tokens and, for an API client, a client secret. It never holds a RemiliaNET password, because users log in on the RemiliaNET login page.

Token storage

Any script that runs in your app can read storage that JavaScript can access. Each kind of storage has a different lifetime:

  • Memory: a page reload clears the tokens.
  • sessionStorage: tokens survive reloads until the session of the tab ends.
  • Persistent browser storage: tokens last longer, but scripts from the origin of your app can read them.
  • Operating system credential store: a desktop app keeps refresh tokens there.

Memory and session storage require another login after a restart. Tokens stay out of URLs, logs, and analytics, and logout removes them.

Browser extension storage

An extension keeps access tokens and refresh tokens in trusted background code, not in content scripts. It accepts only the callers and the actions that it supports and returns no tokens through page messages.

A Manifest V3 worker can stop while the browser stays open, and it loses its memory when it stops. The extension saves the state, the nonce, and the PKCE verifier before it opens the login window, uses the saved transaction once to validate the callback, and then deletes it. A worker that stops during login can require another login. Persistent storage is limited to trusted extension contexts. For the lifetime of chrome.storage.session, see Connection lifetime.

Expiry and refresh

expires_in gives the lifetime of the access token in seconds. An app reuses the token until it nears expiry, and it does not request a token for each API call. Renewal needs a valid refresh token and a connection to the issuer.

One refresh request runs at a time. A replacement refresh token replaces the earlier one. A temporary failure keeps the stored refresh token, and invalid_grant clears the local tokens and requires another login. The steps are in Refresh an access token.

Logout and revocation

Each action has a different effect:

A logout invalidates pending login, refresh, and profile requests before it clears storage, and it discards their late results. One token storage update runs at a time, so an earlier refresh cannot restore tokens after logout or overwrite a later login. If a provider request fails, the user stays logged out of your app.

Control labels name the action:

  • Log out of this app only clears the connection of your app. Inside your app, the label can be Log out.
  • Log out of RemiliaNET starts the end-session flow of the issuer.
  • Disconnect app is reserved for trusted revocation of app access.

The steps are in Log a user out of your app.

API client secrets

An API client uses a client secret:

  • The secret lives on your server, or in the operating system credential store for a personal local tool.
  • The secret stays out of source control, browser bundles, logs, and shell history.
  • No distributed app contains a shared secret. A browser-only app uses a Login client.

If a secret is exposed, see Client credentials are exposed.