OAuth sign-in with minimal scopes
Published 2026-11-06
Sign-in is not data access
Offering sign in with Google, Microsoft, LinkedIn or GitHub is attractive: no password to forget, no password database to protect. But the same button can ask for very different things. A request for basic identity is a different promise from a request for mail, calendar or files, and users and reviewers treat them differently.
Ask for the least
For a pure login, the standard OpenID scopes are enough: openid, email and profile. They return an account identifier, an email address, a name and a picture. Anything beyond that should be justified by a feature the user is actually using, and requested at that moment, not at sign-in.
Minimal scopes make the consent screen shorter, which improves conversion, and they usually avoid the extended verification that sensitive scopes trigger at the provider.
What to store
Store the provider's stable account identifier, not just the email, because emails change and can be recycled. Treat an email returned by the provider as verified only if the provider says so. Be deliberate about linking: automatically merging a social login into an existing account with the same email lets an attacker with a weakly verified provider account take it over.
Say it in the privacy policy
Your policy should state which providers you support, which scopes you request, what you do with the data and how a user can delete it. Providers check this during branding verification, and users deserve the plain explanation anyway. If you use Google data, link the Google API Services User Data Policy and confirm that your use adheres to its limited use requirements.
Handle revocation and deletion
Users can revoke access from their provider at any time, so your app must cope with tokens that stop working. Offer a deletion route that removes the account and the data received from the provider, with a stated time limit, and keep only what the law requires you to keep.
The sign-in flow in plain words
The user clicks a provider button and is sent to the provider, where they prove who they are and see what the application is asking for. The provider returns the user to your site with a short-lived code, which your server exchanges for the identity data the scopes allowed. Nothing about the user is shared before they approve, and your application never sees their provider password.
Pitfalls to avoid
- Matching accounts only by email address. Link by the provider identifier, and require a verified email before merging with an existing account.
- Skipping the state parameter, which protects the flow against forged callbacks.
- Registering broad redirect URLs; list the exact callback addresses for each environment.
- Treating the provider as the only way in; keep a recovery path for people who lose access to that account.
Operating it over time
Provider consoles have their own consent screens, verification steps and review rules, and they change. Keep the app name, logo, privacy policy and contact address on those screens accurate, and re-check them when you change scopes. Minimal scopes keep this routine: there is little to justify, little to audit and little to lose if something goes wrong.