'Using Google Gmail API for Desktop Application

I have a desktop application which sends email from Gmail using SMTP.

Since Less secure Apps will not longer be supported, I am trying to use Google API with OAuth2. Is there any other way I can use to send email from Gmail accounts?

Also, if I use Google API with OAuth2 can we configure the client ID and client secret generated from Admin Gmail account and use the same for all the other users for authorization?

I am following this tutorial: https://www.youtube.com/watch?v=44ERDGa9Dr4

Thanks in advance!



Solution 1:[1]

I have a desktop application which sends email from Gmail using SMTP. Since Less secure Apps will not longer be supported, I am trying to use Google API with OAuth2.

If you want to stick with smtp did you consider checking out Did you consider checking Xoauth2?

Have you tried using an app password im not sure if thats going away as well.

Can we configure the client ID and client secret generated from Admin Gmail account and use the same for all the other users for authorization?

If you have a google workspace domain, Then you could use a service account and set up domain wide delegation which would allow the service account to impersonate any user on your domain.

If these are standard google gmail email accounts then you will need to use oauth2 to request consent from each user.

verification

remember if you switch to Oauth2 you will need to have your app verified

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DaImTo