Tokens and sessions
After the code exchange your app holds two tokens. They follow the same rules as OAuth 2.1 and the current IETF best practice: short access tokens, rotating refresh tokens, reuse detection.
Access token
A JWT signed with EdDSA (Ed25519), valid 5 minutes (expires_in: 300). Your app sends it to your server in Authorization: Bearer …; your server verifies it without calling Novren ID, with the public keys at https://id.novren.net/.well-known/jwks.json.
Header:
{ "alg": "EdDSA", "kid": "…", "typ": "at+jwt" }Claims:
| Claim | Value |
|---|---|
iss | https://id.novren.net |
sub | the account id (UUID): your user id |
aud | your app id only: a token for another app is refused |
iat, exp | issued at, expires 300 seconds later |
jti | unique id of this token |
sid | the session (token chain) it belongs to: revoking the chain revokes the token |
plan | the user's plan for your app |
Use @novren/id-verifier
It checks signature, issuer, audience, type, expiry and revocations in one call. Verifying the JWT with a generic library checks only the first part: a revoked token would still pass for up to 5 minutes. See Protect your API.
Refresh token
An opaque string (43 characters) that gets a new access token from POST /oauth/token. It is valid 30 days, and:
- it changes at every use. The answer contains a new refresh token; the old one stops working. Always store the new one;
- reusing an old one closes the whole chain. If a refresh token is presented twice, Novren ID assumes it was stolen and revokes the session: both the thief and the user are signed out of your app;
- every refresh starts a new 30 days, so a user who opens your app at least once a month stays signed in.
The session (token chain)
Every sign-in starts a chain: the first refresh token, every refresh token that replaced it, and every access token issued along the way. All of them share the same sid. A chain ends when:
| Cause | Who |
|---|---|
revokeTokens (logout) | your app |
| reuse of an old refresh token | Novren ID, automatically |
| the user changes password, or the account becomes inactive | Novren ID (refused with account-changed) |
| the user disconnects your app, deletes it, or deletes the Novren ID | the user |
| you disable the client or the app | you, from the console |
| 30 days without a refresh | expiry |
When a chain ends, refreshTokens returns null and your app must sign the user in again.
How revocation reaches your server
Access tokens are verified offline, so a revocation must reach your server some other way. createTokenVerifier reads a revocation feed (GET /oauth/revocations) every 5 seconds and refuses tokens of closed chains, or of accounts that revoked everything, from that moment.
If the feed can't be read for more than 60 seconds, the verifier refuses every token (TokenRejected with reason unavailable) instead of accepting them blindly. This is called fail closed: better a user who has to retry than a revoked token that still opens data.