Developer Implementation Guide
Implement strong authentication and authorization
Strong authn and authz prevent unauthorized access to personal data and limit the blast radius when accounts or keys are compromised. Build on proven standards, enforce least privilege, and make every access decision auditable.
Implement Strong Authentication and Authorization
Strong authn and authz prevent unauthorized access to personal data and limit the blast radius when accounts or keys are compromised. Build on proven standards, enforce least privilege, and make every access decision auditable.
Authentication Fundamentals
Use a standards-based identity layer such as OIDC with OAuth 2.0.
Store passwords with Argon2id or bcrypt and require email verification.
Enforce a password policy and prevent credential stuffing with rate limits.
Multi-Factor Authentication
Require MFA for admins and high-risk actions.
Support TOTP and WebAuthn passkeys to reduce phishing risk.
High-risk actions: change email, export data, delete account, view bulk reports.
Policy: force MFA step-up if the last MFA was > 12 hours ago or the device is new.
Sessions and Tokens
Prefer short-lived access tokens with refresh rotation.
Validate issuer, audience, expiry, and signature for every token.
For cookie sessions, set HttpOnly, Secure, SameSite=Lax or Strict, and bind to the user agent where feasible.
Authorization Patterns
Default-deny and check permissions at every boundary.
Combine RBAC for simplicity with ABAC checks for ownership and context.
Service-to-Service Trust
Use mTLS or OAuth 2.0 client credentials between services.
Pin and rotate service keys with a KMS and verify JWT audience per service.
Secrets and Key Management
Keep secrets in a managed vault and never in source control.
Rotate keys regularly and scope each key to the minimum needed action.
Abuse and Account Security
Rate limit login, sign-up, and password reset endpoints.
Lock accounts temporarily on repeated failures and send alerts on unusual sign-ins.
Restrict admin consoles by IP allowlist or require a VPN.
Auditing and Lifecycle
Log authentication events and authorization decisions with user, action, resource, and outcome.
Automate provisioning and offboarding. Remove access when roles change.
Quick Authn and Authz Checklist
Use OIDC and hash passwords with Argon2id or bcrypt
Enforce MFA for admins and step-up for high-risk actions
Set short-lived tokens and secure cookie flags with rotation
Apply default-deny with RBAC plus ownership checks
Protect service calls with mTLS or OAuth client credentials and key rotation
Rate limit auth endpoints and log all access decisions for audit
Conclusion
Robust authentication and precise authorization keep personal data accessible only to the right identities at the right time. By standardizing on proven protocols, enforcing least privilege, and recording every decision, you reduce breach impact, simplify audits, and meet GDPR and CPRA expectations for security and accountability.