1. Sessions and JWT Token
- Session-based:
- Cost: database for session storage.
- Pro: you can active reclaim the session in server.
- Token-based:
- Pro: Read the claims from the token itself, do not need to store db
- Cons: Need the expired time, until that user can still access.
2. How to store tokens in browser
- Cookie: httpOnly, JS can not read it.
- Memory: not choice, refresh loss token.
3. OAuth, Authentication (OIDC, PKCE)
.png)
- PKCE: (code challenge, code)

4. Authorization Models
4.1. RBAC (Role-based)
4.2. ABAC (Attribute-based)
4.3. ReBAC (Relationship-based)
- Document sharing.
- Owner sharing.
5. Password Storage
- Use Argon2id, scrypt, or bcrypt: deliberately slow and memory-hard, which makes brute-forcing expensive.
- Salt: a different password has a random different salt.