awesomemotive / WP-Mail-SMTP

The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 3 million sites.
https://wordpress.org/plugins/wp-mail-smtp/
GNU General Public License v3.0
55 stars 34 forks source link

Improve Errormessages for already granted scopes with Google Authentication #120

Closed max2play closed 1 year ago

max2play commented 1 year ago

Expected Behavior

When connecting with Google Mail, the Permissionscreen might already contain existing scopes (e.g. Google Analytics) as WP-Mail-SMTP uses "setIncludeGrantedScopes(true)" on initialisation. The plugin could check, if the connection to google is not successful because of additional scopes and show an error containing something like: "you are giving too much power over your google account to this plugin - better use a separate google client or remove the existing permissions for your mailadress".

Current Behavior

Just an error that something went wrong - difficult to debug.

capuderg commented 1 year ago

Hi @max2play,

we recommend our users to create a new Google oAuth App for our integration and we show how to do it in our documentation.

We would like to reproduce this issue, to see what info/error codes are available, so we can improve our plugin.

Could you please provide us with the steps needed to reproduce this scenario?

Thank you and have a nice day!

max2play commented 1 year ago

Hi Gregor, thanks for your reply. If all users follow your documentation you could also use "setIncludeGrantedScopes(false)" (problem solved) or maybe add a part to the documentation that says: if there are any other scopes granted for the user the authentication will fail. To test the current error message, you can add any other permission (scope) for your google user account besides the one that is allowed. Maybe use Google Analytics, Google Drive or any other Google Service. The current error message is triggered after this line: https://github.com/awesomemotive/WP-Mail-SMTP/blob/d1cefbc5d48dc9ed313355c50527054799d8bcb1/src/Providers/Gmail/Auth.php#L286-L289

capuderg commented 1 year ago

Thank you for sharing this info. We've created an internal GH issue and we'll let you know once this is fixed and released.

Thank you again and have a nice day!

capuderg commented 1 year ago

Hi @max2play,

our new version: v3.7.0 was released today and your suggested fix was included in this release.

Thank you again for reporting this issue. We really appreciate it!