
* are found an appropriate message is printed. * Print all Labels in the authorized user's inbox. (token.access_token) ĭocument.getElementById('content').innerText = '' ĭocument.getElementById('authorize_button').innerText = 'Authorize' For a catch-all, use 'Inbox,' for the var. * Callback after Google Identity Services are loaded. Click here to make a copy of the Google Auto-Purge Script The script deletes emails based on label, so you'll need to enter the labels you want here. * Callback after the API client is loaded. Gapi.load('client', initializeGapiClient) Authorization scopes required by the API multiple scopes can beĭocument.getElementById('authorize_button').style.visibility = 'hidden' ĭocument.getElementById('signout_button').style.visibility = 'hidden' Discovery doc URL for APIs used by the quickstart TODO(developer): Set to client ID and API key from the Developer Console In the index.html file, paste the following sample code: In your working directory, create a file named index.html.For more details, see Applying API key restrictions.
GMAIL AUTOPURGE SCRIPT UPDATE
Click Restrict key to update advanced settings and limit use.The API key can also beįound in the "API keys" section of your project's credentials. To copy your API key for use in your app's code. Make a note of these credentials because you need them later in this quickstart. The newly created credential appears under OAuth 2.0 Client IDs. Client secrets aren't used for Web applications. The OAuth client created screen appears, showing your new Client ID and Client secret. Then, enter an endpoint URI to which the OAuth 2.0 server can send responses. Server-side apps (Java, Python, and more)–Under Authorized redirect URIs, click Add URI.This identifies the domains from which your application can send API requests to the OAuth 2.0 server.


Then, enter a URI to use for browser requests. Client-side apps (JavaScript)–Under Authorized JavaScript origins, click Add URI.Add authorized URIs related to your app:.This name is only shown in the Google Cloud console. In the Name field, type a name for the credential.Click Application type > Web application.Click Create Credentials > OAuth client ID.In the Google Cloud console, go to Menu menu > APIs & Services > Credentials. You must create a separate client ID for each platform. To authenticate as an end user and access user data in your app, you need toĬreate one or more OAuth 2.0 Client IDs.

In the Google Cloud console, enable the Gmail API.Īuthorize credentials for a web application You can turn on one or more APIs in a single Google Cloud project. Enable the APIīefore using Google APIs, you need to turn them on in a Google Cloud project. To complete this quickstart, set up your environment. If you're unfamiliar with authentication and authorization forĪuthentication and authorization overview.Ĭreate a JavaScript web application that makes requests to the Gmail API. Before you can run the sampleĪpp, each quickstart requires that you turn on authentication andĪuthorization. You use the client libraries for your own apps. Google Workspace quickstarts use the API client libraries to handle someĭetails of the authentication and authorization flow.
GMAIL AUTOPURGE SCRIPT HOW TO
Quickstarts explain how to set up and run an app that calls a
