Getting started
Session Lab
An interactive demo that runs the real Authyra against a fake, strict auth server in your browser.
The Session Lab runs Authyra, AuthyraInterceptor and Dio in your browser, against an auth server you can break. Nothing is mocked on the client side: only the server and the network are simulated.
What is on screen
- The app: a small expenses app, signed in through Authyra. Its data comes from the server, which picks it from the access token: you see whose token each request carried.
- The session: the access token counting down, and every request drawn as a line, with refreshes shown as bands across them.
- The server: a strict auth server with short access tokens (20 seconds by default) and single-use refresh tokens. Presenting a used refresh token revokes the whole session, with no grace period.
The tour
- Sign in. The app receives an access token and a refresh token.
- Break a naive client. The app sends its requests through a hand-written interceptor instead. The server rotates its signing keys, 20 requests get a 401 at once, and each one refreshes on its own. The second refresh presents a used token: the server revokes the session, and the app finds out on its next request.
- Same burst with Authyra. The 20 requests wait behind a single refresh, then retry with the new token. One refresh call, 20 successes, still signed in.
- Keep breaking it.
- Cut the network: refreshes fail, the session is kept, retries back off.
- Restart the app: the session is restored from storage.
- Revoke on the server: the next refresh is refused and the app signs out.
- Add a second account and switch: each account keeps its own tokens.
Source
The lab lives in examples/authyra_demo. Its scenarios are covered by end-to-end tests in test/lab_test.dart.