Getting 400 Error: redirect_uri_mismatch when trying to grant permission to Gmail SMTP plugin

I am trying to add Google SMTP plugin to my wordpress website.

I have installed plugin, then went to Google Developer Console created new project, added Gmail API, added Credentials.

Now this step came out different to how I remember it used to be. Instead of getting API key I got a JSON file that has all the info, still fields seem to match mostly.

I then went to settings form in Gmail SMTP Plugin and mapped settings in following way:

Client id field to client_id from Json

Client Secret field to private_key from Json

Client Email field to client_email from Json

(see below)

When I try to Grant Permission I get

  1. That’s an error.

Error: redirect_uri_mismatch

The redirect URI in the request, http://localhost/wordpress/wp-admin/options-general.php?page=gmail-smtp-settingsaction=oauth_grant, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/113520075367233598862?project=[my_project_id]

So I clicked the link and added http://localhost/wordpress/wp-admin/options-general.php?page=gmail-smtp-settingsaction=oauth_grant in google developer console, OAuth Conscent Screen tab Homepage URL (Optional) field and saved it but error remains my guess is ether I am not putting url into correct place or because I am running app from localhost.

Where do I need to set up redirect url for this error to go away?

Topic smtp email plugins Wordpress google

Category Web


Sorted out myself:

JSON file indeed was the issue I went back to Google Developer Console and choose to create Credentials again it then gave me an option of OAuth client Id and later an option to add origin and redirect urls which sorted the issue.

enter image description here

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.