Course contentsShow
← Computer Science
Lesson 2540 of 2,87256. Authentication and AuthorizationFree lesson

OAuth 2.0 Scopes and Consent

Understand how scopes limit access permissions and how users grant consent for specific resource access.

OAuth 2.0 Scopes and Consent

You'll learn how scopes precisely limit what an access token can do and how users explicitly approve those permissions.

What Are Scopes?

In OAuth 2.0, scopes define the boundaries of what a client application can access on behalf of a user. Think of scopes like specific keys on a keyring—each one opens only certain doors. When a client requests an access token, it specifies which scopes (permissions) it needs.

For example, a photo-printing app might request photos:read scope to view your images, but not photos:delete. The access token is then limited to read-only operations, even if the app tries to delete photos later.

How Consent Works

Consent is the process where the resource owner (the user) explicitly authorizes the client to access specific resources with the requested scopes. During the OAuth flow (typically the Authorization Code Grant), the authorization server presents a consent screen showing which permissions the client is requesting.

The user reviews these scopes and decides whether to approve or deny. Only after consent does the authorization server issue tokens with those specific scopes embedded. This puts the user in control—they see exactly what they're granting access to.

Scope String Format

Scopes are typically space-delimited strings like read:profile write:posts read:messages. The authorization server validates requested scopes and may grant fewer than requested based on user consent or policy restrictions.

Why This Matters

Scopes implement the principle of least privilege—applications get only the permissions they need, nothing more. This limits damage from compromised tokens and builds user trust by making permissions transparent.

Key Takeaway: OAuth 2.0 scopes precisely define what an access token can do, while the consent process ensures users explicitly approve those permissions before granting access.