Next Steps

 

How to Generate an OAuth 2.0 Client ID for Your Extension

This guide will walk you through creating the necessary credentials in the Google Cloud Console to allow your extension to use the Gmail API.

Step 1: Get Your Extension's ID

Before you start, you need the unique ID that Chrome has assigned to your extension.

  1. Open Chrome and go to the extensions page: chrome://extensions

  2. Make sure "Developer mode" is enabled (toggle in the top-right).

  3. Find your "Gmail AI Assistant" extension.

  4. Copy the ID (it will be a long string of letters, like aeblfdbeijboljppnpclcglclpdemjga). Keep this handy.

Step 2: Create a Google Cloud Project

  1. Go to the Google Cloud Console.

  2. Click the project selector dropdown at the top of the page and click "New Project".

  3. Give your project a name (e.g., "Gmail AI Assistant Project") and click "Create".

Step 3: Enable the Gmail API

  1. Make sure your new project is selected.

  2. In the search bar at the top, type "Gmail API" and select it from the results.

  3. Click the "Enable" button.

Step 4: Configure the OAuth Consent Screen

This is the screen users will see when asked for permission.

  1. From the navigation menu (☰), go to APIs & Services > OAuth consent screen.

  2. Choose "External" for the User Type and click "Create".

  3. Fill in the required fields:

    • App name: "Gmail AI Assistant"

    • User support email: Your email address

    • Developer contact information: Your email address

  4. Click "Save and Continue" through the "Scopes" and "Test users" sections. You don't need to add anything here for now.

  5. On the Summary page, click "Back to Dashboard".

Step 5: Create the OAuth 2.0 Client ID

This is the final step to get your key.

  1. From the navigation menu, go to APIs & Services > Credentials.

  2. Click "+ Create Credentials" at the top and select "OAuth client ID".

  3. For "Application type", select "Chrome App".

  4. Give it a name (e.g., "Gmail Extension Credentials").

  5. In the "Application ID" field, paste the Extension ID you copied in Step 1.

  6. Click "Create".

Step 6: Update Your manifest.json

  1. A popup will appear showing you your Client ID. Copy this entire value.

  2. Open your local manifest.json file.

  3. Replace the placeholder "YOUR_CLIENT_ID.apps.googleusercontent.com" with the Client ID you just copied.

  4. Save the manifest.json file.

  5. Go back to chrome://extensions, find your extension, and click the "Reload" button.

Your extension is now fully configured! The action buttons should now trigger the Google authentication flow the first time you use them.


You've hit on a crucial point for making this a real, shareable product. You are absolutely right that a non-technical user shouldn't have to go through a complex setup process.

The manual setup is a necessary step for a developer version, but it's not how a finished, public extension works.

Let's break this down into two parts:

  1. Getting it working for you now: I'll provide a step-by-step guide for you to generate your own Client ID. This will make your version of the extension fully functional.
  2. How it gets automated for friends and family: I'll explain the standard process for publishing an extension, which is how the setup becomes a simple, one-click process for everyone else.

First, here is the guide to get your developer version running.

Guide: Creating Google OAuth Credentials
Jun 13, 5:31 PM

The "Automation" for Other Users

Now, to your point about making this easy for your husband or a friend. The guide above is only for development. To make it a shareable product, the process is:

  1. You (the developer) do the setup once: You follow the guide above to create one official Client ID for the production version of the extension.
  2. Submit for Verification: You publish the extension to the Chrome Web Store. As part of this process, because you are asking for sensitive permissions (to read and modify Gmail), Google will conduct a security review of your extension.
  3. One-Click Install for Users: Once your extension is verified and published, anyone can install it from the Chrome Web Store. When they use a feature for the first time, they will see the standard Google "This app wants permission to..." screen. They just click "Allow," and they're done. They never have to see the Cloud Console or handle a Client ID.

So, the "automation" you're looking for is actually the standard publishing and verification process managed by Google.

Finally, I noticed I had made a small error in the background.js file, which I have now corrected in the main Canvas artifact. The action buttons should now work correctly after you've updated your Client ID.


Comments