If the user approves, then Google gives your application a short-lived access token.Google displays a consent screen to the user, asking them to authorize your application to request some of their data.When your application needs access to user data, it asks Google for a particular scope of access.(If the API isn't listed in the API Console, then skip this step.) Activate the Google Sheets API in the Google API Console.Google then provides information you'll need later, such as a client ID and a When you create your application, you register it using the Google API Console.The following general process applies to all application types: The details of the authorization process, or "flow," for OAuth 2.0 vary somewhat depending on what kind of application you're writing. Requests to the Google Sheets API for non-public user data must be authorized by an authenticated user. If your application uses Google Sign-In, some aspects of authorization are handled for you. No other authorization protocols are supported. Your application must use OAuth 2.0 to authorize requests. If the request doesn't require authorization (such as a request for public data), then the application must provide either the API key or an OAuth 2.0 token, or both-whatever option is most convenient for you.
The application may also provide the API key, but it doesn't have to.
If the request requires authorization (such as a request for an individual's private data), then the application must provide an OAuth 2.0 token with the request.
Here's how to determine which of those options to use: There are two ways to identify your application: using an OAuth 2.0 token (which also authorizes the request) and/or using the application's API key. When your application requests public data, the request doesn't need to be authorized, but does need to be accompanied by an identifier, such as an API key.Įvery request your application sends to the Google Sheets API needs to identify your application to Google. When your application requests private data, the request must be authorized by an authenticated user who has access to that data.