### [Error: invalid_grant: Token Expired or Revoked](https://wpmailsmtp.com/docs/error-invalid_grant-token-expired-or-revoked/)

**Published:** May 17, 2026
**Author:** David Ozokoye

**Content:**

**Note**: This guide applies to the [Gmail mailer](https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/ "Gmail") in WP Mail SMTP.

## What This Error Means

The OAuth refresh token WP Mail SMTP uses to send via Gmail has expired or been revoked by Google. The plugin can no longer obtain new access tokens, and email sending fails.

## Common Causes

- Refresh token expired after 7 days (Google policy for apps in “Testing” mode that request sensitive scopes like Gmail)
- Refresh token unused for 6 months (Google revokes inactive tokens regardless of publishing status)
- You changed the Google account password
- You manually revoked access at [myaccount.google.com](https://myaccount.google.com/ "Google Account") » **Security** » **Third-party apps**
- Google detected unusual activity and revoked tokens as a security measure
- Account exceeded the 50 refresh token limit per OAuth client (Google revokes the oldest token automatically)

## How to Fix

Here is the complete step-by-step guide to resolving the error.

### Step 1: Publish the OAuth App to Production (Testing Mode Only)

If the token expires every 7 days, the Google Cloud project is still in **Testing** mode. Publish the OAuth app to production first, then reconnect. If your project is already in production, skip to Step 2.

Start by opening the [Google Cloud Console](https://console.cloud.google.com/ "Google Cloud Console"). Then, navigate to **APIs & Services » OAuth consent screen** and click the **Audience** tab.

Next, click **PUBLISH APP**, then click **CONFIRM**.

![Publish app](https://wpmailsmtp.com/wp-content/uploads/2025/03/publish-app.png)Finally, verify that the status changes to **In production**.

### Step 2: Reconnect Your Google Account

The fastest way to resolve an expired or revoked token is to reauthorize WP Mail SMTP with Google.

Start by going to **WP Mail SMTP » Settings** and scrolling to the **Google / Gmail** mailer section. Then, click **Remove Connection**.

![Click Remove Connection](https://wpmailsmtp.com/wp-content/uploads/2020/10/Remove-Connection-in-WP-Mail-SMTP.png)After that, click **Allow plugin to send emails using your Google account**.

![Click Allow plugin to send emails using your Google account](https://wpmailsmtp.com/wp-content/uploads/2022/12/allow-google-to-send-emails.png)Next, select your Google account and grant the requested Gmail permissions. Finally, once the authorization completes, click **Save Settings**.

### Step 3: Send a Test Email

Confirm the fix by sending a test email.

To test the fix, go to **WP Mail SMTP » Tools** and click the **Email Test** tab. Enter a recipient email in the **Send To** field, leave the **HTML** toggle ON, and click **Send Email**.

![Test email tab](https://wpmailsmtp.com/wp-content/uploads/2024/10/test-email-tab-1024x1002.png)Once done, check for a success message and confirm the email arrived in your inbox.

## Notes

- Changing your Google account password invalidates all existing OAuth tokens immediately.
- On Google Workspace, click **MAKE EXTERNAL** instead of **PUBLISH APP** in the **Audience** tab, then select **In production**.

That’s It! You now know how to fix the ‘invalid\_grant: Token Expired or Revoked’ error in Gmail and get your emails sending again through WP Mail SMTP.

**Categories:** Gmail Errors, Error Library

---

