What are Scopes?
Scopes are a mechanism in OAuth 2.0 and OpenID Connect that define the level of access that an application is requesting from a user. They allow users to grant limited access to their resources without sharing their credentials.OpenID Connect Scopes
| Scope | Claims |
|---|---|
| openid | (required) Returns the sub claim, which uniquely identifies the user. In an ID Token, iss, aud, exp, iat, and at_hash claims will also be present. |
| profile | Returns claims that represent basic profile information, including name, family_name, given_name, middle_name, nickname, picture, and updated_at. |
| Returns the email claim, which contains the user’s email address, and email_verified, which is a boolean indicating whether the email address was verified by the user. | |
| offline_access | Returns a refresh_token. |
openid
Theopenid scope is required for all OpenID Connect authentication requests. It indicates that the application wants to use the OpenID Connect protocol to verify the user’s identity.
- Required: Yes (for OpenID Connect flows)
- Returns: An ID token containing the user’s unique identifier (
subclaim) - Example:
scope=openid
profile
Theprofile scope requests access to the user’s default profile information. When granted, it allows the application to access basic profile claims.
- Required: No
- Returns: Claims such as:
name- Full namefamily_name- Last namegiven_name- First namemiddle_name- Middle namenickname- Casual namepreferred_username- Preferred usernameprofile- Profile page URLpicture- Profile picture URLwebsite- Web page or blog URLgender- Genderbirthdate- Birthdayzoneinfo- Time zonelocale- Localeupdated_at- Time profile was last updated
scope=openid profile
email scope requests access to the user’s email address information.
- Required: No
- Returns: Claims such as:
email- Email addressemail_verified- Boolean indicating whether the email has been verified
scope=openid email
This scope is commonly used when applications need to communicate with users via email or use email as a unique identifier.
offline_access
Theoffline_access scope requests permission to access resources on behalf of the user even when they are not actively using the application.
- Required: No (but required for refresh tokens)
- Returns: A refresh token that can be used to obtain new access tokens
- Duration: Long-lived or indefinite, depending on the authorization server’s configuration
scope=openid offline_access
This scope is essential for applications that need to:
- Perform background synchronization
- Access resources without requiring the user to re-authenticate
- Maintain long-term access to user data
Not all grant types support refresh tokens. The
offline_access scope typically works with the Authorization Code flow and may not be available for Client Credentials or other flows.Additional Scopes
phone
Thephone scope requests access to the user’s phone number information.
- Required: No
- Returns: Claims such as:
phone_number- Phone numberphone_number_verified- Boolean indicating whether the phone number has been verified
scope=openid phone
address
Theaddress scope requests access to the user’s postal address information.
- Required: No
- Returns: A JSON object containing:
formatted- Full mailing addressstreet_address- Street addresslocality- City or localityregion- State, province, or regionpostal_code- Zip code or postal codecountry- Country name
scope=openid address
Combining Scopes
Multiple scopes can be requested in a single authorization request by separating them with spaces:- Use OpenID Connect authentication (
openid) - Request access to profile information (
profile) - Request access to email address (
email) - Request a refresh token for offline access (
offline_access)
Best Practices
- Principle of Least Privilege: Request only the minimum scopes required for your application’s functionality
- Transparent Communication: Clearly explain to users why your application needs specific scopes
- Progressive Authorization: Request additional scopes only when needed, rather than all at once
- Secure Storage: Store tokens securely, especially refresh tokens obtained through
offline_access
Scope Consent
When an application requests scopes, users are typically presented with a consent screen showing:- What application is requesting access
- What specific permissions (scopes) are being requested
- What data will be accessible to the application
- Approve: Grant the requested scopes to the application
- Deny: Refuse the authorization request
- Partial Approval (if supported): Grant only some of the requested scopes