A breach starts with a single request. One misconfigured OAuth 2.0 flow can expose Personally Identifiable Information (PII) to anyone watching. It doesn’t matter if your tokens are short-lived or your TLS is perfect—if your scopes are too broad or your redirect URIs leak parameters, the data is gone.
OAuth 2.0 PII leakage prevention starts with tight control over authorization scopes. Never grant more access than the client absolutely needs. Audit every scope against the PII it can expose. Common mistakes include combining profile scopes with sensitive identity claims, or leaving open-ended read permissions.
Validate redirect URIs with strict allowlists. Attackers exploit loose wildcard patterns to capture authorization codes in rogue endpoints. Always enforce HTTPS and avoid query strings containing PII in redirects and callback flows.
Keep tokens out of logs. Access tokens and ID tokens often contain user claims. If your logging infrastructure stores them, you’ve already leaked PII. Use structured logging to filter out sensitive fields before they ever hit disk.