I thought I'd searched exhaustively for a Drupal module that authenticates to Gmail using OAuth2, but I guess not. Yesterday I came across Gmail API ( https://www.drupal.org/project/gmail β ). I installed it, and it seems to work fine; no need to write another.
I've changed the code, and it works fine. As far as I'm concerned, this can be closed.
Thanks again.
The email address in question is the one used by the site for sending out password reset emails, etc. It's not user-specific.
Your response made me realize, however, that the address I'm looking for is the email address entered on the "Basic site settings" page, which is presumably the address used by PHPMailer to send mail (I need to confirm that). In any case, the address is already collected and stored either by Drupal or by PHPMailer, so there's no need to ask for it again. I just need to modify the code to retrieve the site email address, and make it clear in the README that the site address must match the address used to sign in to Google Workspace.
Thanks.
westsonoma β created an issue.
There is now a second module, available at https://github.com/iagsdc/oauth2_client_gmail_plugin, that's written as a plugin to Drupal module OAuth2 Client. OAuth2 Client is designed to handle backend functionality for retrieval and storage of OAuth2 tokens. Both modules (the new one, and the one at https://github.com/iagsdc/phpmailer_gmail_oauth2) require a Google provider library (league/oauth2-google) available at https://oauth2-client.thephpleague.com/providers/league/, and both also require the PHPMailer SMTP module. Neither module can be installed with composer.
I'm not completely certain this belongs here, so feel free to disregard.
When looking for a solution to the upcoming Google/GMail Oauth2 issue, I came across PHPMailer OAuth2 β , which is a plugin for PHPMailer SMTP. It addresses Azure, not Google/GMail, but it provides a roadmap for developing an Oauth2 plugin that works with PHPMailer SMTP.
I've now written such a module. I lack the credentials to make it available as a Drupal module (I may work on that), so I've placed it on GitHub at https://github.com/iagsdc/phpmailer_gmail_oauth2. It cannot be installed by composer, but it can be dropped into either the /web/modules/contrib or /web/modules/custom directory. It requires a Google provider library (league/oauth2-google) that can be found at https://oauth2-client.thephpleague.com/providers/league/, and it requires the PHPMailer SMTP module.
It's only been tested on Drupal 10. As I said, I'm not sure this belongs here, but maybe it will help someone out.
Aggregation of both CSS and JavaScript worked fine on a new install of Drupal 10.1.2 until I set the file_assets_path and file_public_path in settings.php. After that, JavaScript aggregation stopped working, although CSS was fine.
The values I used were:
$settings['file_assets_path'] = 'sites/mysite/files/optimized';
$settings['file_public_path'] = 'sites/mysite/files';
With these settings, I could get JavaScript to work again only by unchecking the 'Aggregate JavaScript files' checkbox.
I removed both settings to let them default, and JS aggregation once again started working. I put back only $settings['file_assets_path'], and JS is still working, and the aggregated JS and CSS files are now under the 'optimized' directory.
It seems likely I don't understand what $settings['file_public_path'] is meant to do. If you're experiencing this problem, you might want to play with these settings.