go backBack to blog

Debugging EmailJS with Gmail API: A Quick Read

Published on Sep 29 2025

Last updated on Sep 29 2025

Photo by Justin Morgan @justin_morgan from Unsplash
No translation available.
Add translation

Recently I ran into an issue where my web app stopped sending emails through EmailJS. The first clue came from running a test directly in the EmailJS dashboard. It returned a 412 error:

makefile

Gmail_API: Request had insufficient authentication scopes.

This indicated that the OAuth credentials configured for Gmail did not include the necessary gmail.send scope. The fix required three steps:

  1. Enable Gmail API in Google Cloud I created a project in the Google Cloud Console and enabled the Gmail API under APIs & Services → Library. Without this step, OAuth credentials cannot access Gmail endpoints.

  2. Verify OAuth client credentials I confirmed the OAuth client ID and secret were created under APIs & Services → Credentials. I ensured that the OAuth consent screen was configured, and the Gmail gmail.send scope was added. This allows sending emails while restricting access to other Gmail data.

  3. Update EmailJS service ID in the app The test email worked in the EmailJS dashboard, but the web app failed with “Service ID not found.” Inspecting the app revealed an outdated service ID. Updating it to the current service ID from EmailJS restored functionality.

Once these steps were completed, test emails in EmailJS succeeded, and the web app could send emails reliably.

The key takeaways from this debugging process:

  • Scope errors manifest as authentication issues. 412 errors are often related to missing or incorrect OAuth scopes.

  • Dashboard tests can mask app-level misconfigurations. Just because a test email works in EmailJS doesn’t mean the app is correctly configured.

  • Service ID and credentials must be current. Any change in EmailJS services requires updating IDs in the application.

Debugging APIs is a process of elimination: check credentials, check permissions, check IDs. Following each step methodically identifies the failure point. In this case, insufficient Gmail scopes and an outdated service ID were the only issues.

Tags:
debugging
My portrait picture

Written by Alissa Nguyen

Alissa Nguyen is a software engineer with main focus is on building better software with latest technologies and frameworks such as Remix, React, and TailwindCSS. She is currently working on some side projects, exploring her hobbies, and living with her two kitties.

Learn more about me


If you found this article helpful.

You will love these ones as well.

  • Image by GuerrillaBuzz @guerrillabuzz from Unsplash
    Sep 29 2025 — 5 min readSolving Node and npm Mismatch Issues on macOS
    #debugging

  • Built and designed by Alissa Nguyen a.k.a Tam Nguyen.

    Copyright © 2025 All Rights Reserved.