Cloudflare Enhances OAuth Security with Granular Scope Customization
Cloudflare introduces optional OAuth scopes, allowing users to grant applications more specific permissions and improving the security and user experience of delegated access.

Cloudflare has rolled out a significant enhancement to its OAuth implementation, introducing "scope customization" that allows developers to mark specific permissions as optional. This feature empowers users to grant applications a more narrowly defined subset of requested access during the authorization process, moving away from the traditional all-or-nothing consent model. This change aims to bolster security by giving users finer control over their data and to improve the user experience by preventing overwhelming consent screens.
OAuth, a standard for delegated access, enables applications to act on behalf of a user without requiring them to share long-lived credentials or passwords. While effective, the model relies on scopes to define the extent of an application's access. As applications and their permission needs have become more complex, the static, all-or-nothing consent screen presented a challenge. Previously, if a user was uncomfortable with the full scope of permissions requested by an application, their only recourse was to deny the authorization entirely, even if they were willing to grant a portion of the requested access.
This new feature builds upon the flexibility already present in the OAuth specification, which permits authorization servers to grant a narrower set of scopes than what was initially requested. Cloudflare has implemented this to work seamlessly with existing applications. Developers can now configure their OAuth clients to designate certain scopes as either required or optional. During the authorization flow, users will see these optional scopes and can choose to deselect them, thereby reducing the application's granted permissions.
Crucially, the evaluation of required and optional scopes is dynamic, based on the specific scopes requested in an individual authorization flow, rather than the entire set of scopes configured for the OAuth client. This means that if an application requests a subset of its configured scopes, only those requested scopes will be considered for the optional/required determination on the consent screen. This approach ensures that the consent screen remains focused on the immediate authorization task and preserves the default behavior for existing OAuth clients that do not opt into the new feature.
When a user deselects optional scopes, the access token generated for the application will only reflect the permissions the user explicitly consented to. Developers must account for this by checking the granted scope set after the authorization code exchange, rather than assuming the full requested scope was approved. Applications designed to gracefully handle partial grants, by operating within the permissions they receive, will foster greater user trust and comfort.
Cloudflare plans to expand this granular control across nearly all its products in the coming weeks, offering more API token roles, account membership options, and OAuth scopes. This initiative aims to provide customers with enhanced tools to secure their workloads with precisely the right level of access.
The introduction of optional OAuth scopes represents a significant step towards a more flexible and trustworthy delegated access experience. By enabling developers to build more nuanced authorization flows and providing users with greater agency over their data, Cloudflare is enhancing both security and usability within its ecosystem.