Search code examples
oauth-2.0gmail-api

Why is this scope expressed as a URI?


https://www.googleapis.com/auth/gmail.metadata

This is from https://developers.google.com/gmail/api/auth/scopes. There are a list of scopes for the Gmail API. I am trying to understand my universe a bit more. These URIs return their scope on a GET - for example, the one above returns "gmail.metadata".

Why do I need to have a URI?


Solution

  • Scopes are just identifiers to represent an area of data and what you can do with that data. They are strings and how they are designed is up to the data owner:

    • When designing them for your own APIs, start with meaningful short names as in this scopes article.

    • When working with third party APIs you have to take what you are given. Large providers such as Google often use logical URL identifiers as namespaces, to ensure no clashes between the many cloud services they provide. These are not meant to be used as physical URLs though.