Toolvito

Works on this device

Oauth Scope Parser

Paste the scope of an OAuth request, a token response or an access token. The tool lists each scope, checks it against the rules of RFC 6749, finds repeats and writes a clean string. It can also compare the scopes that were asked for with the scopes that were granted.

Read or compare scopes

Splits a scope string into its scopes, checks each one against RFC 6749, finds repeats and writes a clean string.

Scopes

Spaces at the start or the end are kept, so that the tool can point them out.

The scopes are read in this page. Nothing is sent.

The scopes will show here

Paste a scope string.

How to use the scope parser

  1. Choose Read a scope string and paste the scope. The result follows as you type.
  2. Choose what the text is: a scope string as OAuth sends it, text copied from an address (with %20 or +), a looser list with commas or line breaks, or JSON such as the scp claim of a token.
  3. Read the table of scopes and the problems found, and copy the clean string or its encoded forms.
  4. Choose Compare two scope lists to see which scopes were granted, which were not, and which came without being asked for.

The rules of a scope string

RFC 6749 section 3.3 defines the scope parameter of OAuth 2.0:

  • Scopes are separated by one space each, with no space at the start or the end. Commas, tabs and line breaks are not separators.
  • A scope is made of printable ASCII characters other than the space, the double quote (") and the backslash (\).
  • Scopes are case-sensitive: profile and Profile are two different scopes.
  • Their order does not matter, and a repeat asks for nothing more.
  • The authorization server decides what each scope means and may grant fewer or other scopes than were asked for; then it must say which scopes it granted.

Scopes in an address

In the address of an authorization request the space between scopes is written as %20, or as + in form encoding (RFC 6749 appendix B). Both read back as a space. The tool gives the clean string in both forms; other characters outside A to Z, a to z, 0 to 9 and - . _ ~ become % and two hexadecimal digits.

Scopes that OpenID Connect defines

Most scopes belong to one service, such as api:read or https://graph.example.com/user.read. OpenID Connect Core 1.0 defines a few that many services share:

  • openid: the request is an OpenID Connect sign-in and asks for an ID token.
  • profile, email, address, phone: ask for the matching claims about the user.
  • offline_access: asks for a refresh token that works when the user is away.

Worked example

The scope string " openid profile openid read,write" has 4 scopes: openid, profile, openid again and read,write. The tool reports a space at the start, two spaces between scopes, a repeat of openid and a comma inside a scope (under RFC 6749 read,write is one scope). The clean string is "openid profile read,write", and for an address it is openid%20profile%20read%2Cwrite.

Asked for "openid profile email offline_access" and granted "openid email profile": 3 scopes are in both, offline_access was not granted, and nothing came without being asked for.

Limits you should know

  • The tool checks the form of scopes only. It does not know what a scope means on a given service, or whether the service will grant it.
  • Scopes are compared exactly as written. Two scopes that differ only in capital letters are named in a note, but they count as different.

Related tools