In turn, the Authorization Server uses the "scope" response parameter to inform the OAuth Client of the scope of the Access Token issued.
The value of the scope parameter is expressed as a list of space-delimited, case-sensitive strings. The strings are defined by the Authorization Server.
If the value contains multiple space-delimited strings, their order does not matter, and each string adds an additional access range to the requested scope.
scope = scope-token *( SP scope-token ) scope-token = 1*( %x21 / %x23-5B / %x5D-7E )
When the openid scope parameter is present it implies this is a OpenID Connect Authentication Request.
The OpenID Connect specification only defines a single set of standard scopes:
Scope | Claims |
---|---|
email, email_verified | |
address | address |
profile | name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, updated_at |
phone | phone_number, phone_number_verified |
openid | sub, auth_time, acr |
If the issued Access Token scope is different from the one requested by the OAuth Client, the Authorization Server MUST include the "scope" response parameter to inform the OAuth Client of the actual scope granted.
If the OAuth Client omits the scope parameter in the Authorization Request, the Authorization Server MUST either process the request using a pre-defined default value or fail the request indicating an invalid scope. The Authorization Server SHOULD document its scope requirements and default value (if defined).[1]
OAuth Scopes has a lot flexibility in case the person needs to self-approve the release of information from the Authorization Server to the OAuth Client. In OAuth 2.0, OAuth Scopes can be used for various purposes. For example OpenID Connect uses OAuth Scopes to "group" attributes.
For example, we could have a scope called "address" that includes the street, city, state, and country user claims.
There could be OAuth Scopes granted that are based on:
Because of the Scope Granted MAY be different than the Scopes in the Authorization Request/Authentication Request, OAuth Scope Validation MUST be performed.
In more complex scenarios where there are multiple API or OAuth Clients products, each with multiple resources which each support multiple distinct actions, a WRITE on one resource is not equivalent to a WRITE on another resource. In these cases, it's a best practice to assign each scope a Unique Identifier name, in the form of an URN.