Docs Error Library Authentication Errors Error: invalid_grant

Error: invalid_grant

What Is Causing This Error?

The ‘invalid_grant’ error often appears when there’s an issue with the permissions granted to an external email application that’s trying to access your mailbox.

For example, if you’re using WordPress, you may see this error if your SMTP plugin doesn’t have the correct access permissions for your Outlook account or if the connection token Microsoft uses has expired.

This error can also appear if you’ve changed your password on a mailer, such as Google or Outlook, that you’ve previously connected to send emails through your SMTP plugin.

Below are some of the variants of this error:

  • invalid_grant: AADSTS70000: Provided grant is invalid or malformed.
  • invalid_grant: AADSTS70000: The user could not be authenticated as the grant is expired.
  • invalid_grant: AADSTS700082: The refresh token has expired due to inactivity. 
  • invalid_grant: AADSTS50173: The provided grant has expired due to it being revoked.

Resolving the Error – Solution

We’ll show you how to fix this using WP Mail SMTP as an example.

To resolve this, you would need to reauthenticate WP Mail SMTP with your mailer.

Go to WP Mail SMTP » Settings and select the General tab. Next, scroll to the bottom of the page and click the Remove OAuth Connection button.

Click Remove OAuth Connection button

Once the page has reloaded, click Allow plugin to send emails using your Gmail account next.

Click button to confirm authorization

This will open a login screen. Go ahead and log in to your account, and click Yes to the Microsoft permissions form if prompted.

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

If you’d like to learn how to set up your DNS records for SendLayer, check out the following docs: