Hello friends,
Ive seen several posts recently with concerns about google disabling username/password gmail useage from 'less secure apps'.
Ive been working with OAuth alot in other projects so Im somewhat familiar with using it.
Ive decided to create a small example of how to send email from GMail using OAuth 2.0.
I cobbled this example together over a couple weekends as I had time so my appologies if it isnt as 'consistent' as it could be.
You will need to do some setup work on google before this code will work.
Please read the README file before running the code.
Regards,
Lewis
Thanks 4 you effort, this was a really gr8 sample to work thru. when these changes r pushed onto us I always wonder if anyone from google ever thinks about the effect of doing stuff like this !!!
In OZ EOFY is 30/6 sorry 6/30 4 all the MMDDYY formatters
So long story short, while in the midst of the busiest time of year we have had calls from 'customers' who cannot receive gmail. So they are using a PC to collect and then process a email from google we would call them legacy systems.
They very rarely send using a PC.
We setup a doc. that tells people how to navigate around this and no 1 got it to work 1st time around, remember we cannot send them an email.
What have you seen around setting up an account to receive, all solutions I have seen are using 2FA, do you have any 'code' that automates this process for them ?
OAuth2 seems to be entirely oriented to browser usage. I do not want to engage a browser just to satisfy OAuth2. Is there a way around this problem?
J.A. Coutts
yes, you could replicate the browser with building your own headers and data and use winsock, would require some in depth knowledge of the HTTP protocol and some time in wireshark.
Also the browser page is important because it allows the user that is giving your app permission, to see what your app is planning on doing (via the scopes). If you get a refresh code along with your access token you only need to engage the browser once, and there after you can get a new access code using only a http request.
Last edited by vbLewis; Jul 1st, 2022 at 09:58 PM.
Thanks 4 you effort, this was a really gr8 sample to work thru. when these changes r pushed onto us I always wonder if anyone from google ever thinks about the effect of doing stuff like this !!!
In OZ EOFY is 30/6 sorry 6/30 4 all the MMDDYY formatters
So long story short, while in the midst of the busiest time of year we have had calls from 'customers' who cannot receive gmail. So they are using a PC to collect and then process a email from google we would call them legacy systems.
They very rarely send using a PC.
We setup a doc. that tells people how to navigate around this and no 1 got it to work 1st time around, remember we cannot send them an email.
What have you seen around setting up an account to receive, all solutions I have seen are using 2FA, do you have any 'code' that automates this process for them ?
TIA
Code wouldnt be hard, you just have to add permissions to the scope list and create a function to read the emails. The problem is that anything other than sending email requires a verified app. Google really wants people to access gmail with a browser so they are picky about what they verify.