···11+# oauth
22+33+at-me uses atproto oauth for authentication.
44+55+## flow
66+77+1. user enters handle on landing page
88+2. app resolves handle → DID → authorization server via did document
99+3. authorization server redirects to user's pds for consent
1010+4. user approves, receives redirect back with auth code
1111+5. app exchanges code for access token
1212+6. token stored in session, used for authenticated api calls
1313+1414+## scopes
1515+1616+```rust
1717+Scope::Known(KnownScope::Atproto),
1818+Scope::Unknown("repo:app.at-me.visit".to_string()),
1919+```
2020+2121+the granular scope `repo:app.at-me.visit` limits write access to only guestbook records.
2222+2323+## session management
2424+2525+sessions use actix-web's cookie-based session middleware. authenticated agents cached in-memory by DID for performance (`AGENT_CACHE`).
2626+2727+see `src/oauth.rs` for implementation.