Error 400: Invalid_request

Overview

Error 400: Invalid_request is typically encountered when setting up a Google OAuth client. This often occurs when sending emails through Gmail’s API.

Causes

There are two main reasons why this error might be occurring on your site:

  1. Improper OAuth consent screen configuration: The OAuth consent screen in the Google Cloud project is not properly set up.
  2. Unauthorized test user: The Google account used for authorization is not listed as a test user on an application that’s set to ‘Testing’ status.

Solution

To resolve Error 400: Invalid_request, follow these steps:

  1. Update OAuth Consent Screen Configuration: Switch to the ‘Testing’ status on your OAuth consent screen if your application is not yet in production. Then, add your Google account as a test user to allow authentication during the testing phase. See our tutorial to learn how to configure OAuth Consent on Google Cloud.
  2. Utilize App Passwords: If you’re using the Other SMTP mailer in WP Mail SMTP, we recommend generating an App Password through your Google Account’s security settings. Then, you’ll need to use this App Password instead of your personal password when authenticating your SMTP plugin.

Note: For details on how to generate an App password, be sure to check out our Other SMTP tutorial to learn how.

That’s it! Now you know how to fix the ‘Invalid_request’ error.

Would you like to improve your site’s email deliverability? Consider configuring an additional connection to use as a backup mailer.