Understanding OAuth 2.0 and Why It Replaced Basic Authentication
There was a time when letting one app access your data on another service meant handing over your actual username and password. A third-party app that wanted to post to your social media account, sync your contacts, or pull your calendar events simply asked for your login credentials directly, and stored them, often indefinitely. That approach, known as basic authentication, created an obvious problem: every app you granted access to became a potential point of failure for your entire account.
OAuth 2.0 solved that problem, and it’s now the standard behind nearly every “Sign in with Google” button and third-party app integration in use today. Understanding how it works explains why modern authentication looks so different from the password-sharing model it replaced.
What Is OAuth 2.0?
OAuth 2.0 is an authorization framework that allows applications to access a user’s data on another service without ever seeing or storing that user’s password. Instead of sharing credentials, the user grants limited, specific permission, called scope, and the app receives a token that proves it has that permission.
It’s important to note that OAuth is an authorization protocol, not an authentication one. It answers the question “what is this app allowed to do?” rather than “who is this user?”, a distinction that matters even though OAuth is often used alongside authentication in practice.
How Basic Authentication Worked and Why It Failed
Under basic authentication, every request to a protected resource included the user’s actual username and password, sent with each API call. Third-party apps wanting ongoing access had to store those credentials somewhere, creating a growing list of places where a single password lived outside the user’s direct control.
This created serious security risks. If any one of those third-party apps suffered a data breach, the user’s actual login credentials were exposed, not just for that app, but for the original account itself, since the same password often worked across multiple services. There was also no practical way to limit what a third-party app could access; once it had the password, it had full account access, whether it needed it or not.
How OAuth 2.0 Works
OAuth 2.0 replaces direct password sharing with a token-based system involving a few key participants: the resource owner (the user), the client (the app requesting access), the authorization server (which issues tokens), and the resource server (which holds the protected data).
The general flow starts when a user tries to grant an app access to their data. Instead of entering credentials into that app, the user is redirected to the authorization server, typically the original service’s own login page, where they log in directly and approve specific permissions. The authorization server then issues an access token to the requesting app, which uses that token to make authorized requests on the user’s behalf, without ever handling the actual password.
Why Access Tokens Are More Secure Than Passwords
Access tokens solve several of the core problems basic authentication created. Tokens can be scoped, meaning an app only receives permission for exactly what it needs, read-only calendar access, for example, rather than full account control. They can also be time-limited, automatically expiring after a set period, which reduces the damage window if a token is ever compromised.
Perhaps most importantly, tokens can be revoked individually without affecting the user’s actual password or other connected apps. If one third-party app’s access needs to be cut off, the user can revoke that specific token without having to change their password across every other service tied to that same login.
Common OAuth 2.0 Grant Types
OAuth 2.0 supports several different flows, known as grant types, designed for different use cases. The authorization code flow is the most common and secure, used when a server-side application needs to access resources on behalf of a logged-in user, involving a redirect and code exchange process.
The client credentials flow is used for machine-to-machine communication, where no individual user is involved, for example, one backend service authenticating with another. Other flows exist for specific scenarios like mobile and single-page applications, each balancing security requirements against the practical constraints of the platform involved.
Where OAuth 2.0 Is Used Today
OAuth 2.0 underlies a huge portion of the authorization happening across the modern internet. Social login buttons, “Sign in with Google,” “Continue with Facebook,” and similar options, rely on OAuth to let users log into third-party sites using an existing account without sharing that account’s password.
API integrations between business tools, such as connecting a calendar app to a scheduling platform or linking accounting software to a payment processor, depend on OAuth to securely share specific data without full account access. Mobile apps that pull data from other services, from fitness trackers to cloud storage, also rely on OAuth as the standard way to request and manage that access safely.
Conclusion: Limitations and Common Misconceptions
Despite its widespread adoption, OAuth 2.0 is often misunderstood. Because it’s frequently used alongside login flows, many assume OAuth handles authentication directly, verifying who a user is, when in fact it’s designed purely for authorization, handling what an app is allowed to access. This is part of why OpenID Connect, a layer built on top of OAuth 2.0, exists specifically to add proper authentication into the mix.
OAuth also isn’t automatically secure just by being implemented, poor implementation, overly broad scopes, or improperly stored tokens can still create vulnerabilities. Its security depends heavily on following the specification correctly, not just adopting the protocol by name.
Frequently Asked Questions
1. Is OAuth 2.0 the same as authentication?
No, OAuth 2.0 is an authorization framework, meaning it controls what an app can access, not who the user is, authentication is typically handled separately or through OpenID Connect.
2. Why is OAuth 2.0 considered more secure than basic authentication?
It avoids sharing passwords directly with third-party apps, using scoped, revocable, and time-limited access tokens instead of full account credentials.
3. What is an access token in OAuth 2.0?
An access token is a credential that proves an app has been granted specific permission to access certain data, without exposing the user’s actual password.
4. Can I revoke access granted through OAuth?
Yes, most services allow users to revoke a specific app’s access token without needing to change their password or affect other connected apps.
5. What’s the difference between OAuth 2.0 and OpenID Connect?
OAuth 2.0 handles authorization, while OpenID Connect is built on top of it to add proper user authentication, confirming identity rather than just permissions.
6. Do all apps that use “Sign in with Google” rely on OAuth 2.0?
Yes, social login buttons typically use OAuth 2.0 combined with OpenID Connect to both authenticate the user and authorize access to specific account data.
