Results 1 to 6 of 6

Thread: GMail Using OAuth 2.0

  1. #1

    Thread Starter
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    118

    GMail Using OAuth 2.0

    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

    Name:  ss.jpg
Views: 291
Size:  40.3 KB
    Attached Files Attached Files

  2. #2
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    EspaСЃa
    Posts
    350

    Re: GMail Using OAuth 2.0

    good job

  3. #3
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,258

    Re: GMail Using OAuth 2.0

    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

  4. #4
    Addicted Member jg.sa's Avatar
    Join Date
    Nov 2017
    Location
    South Australia ( SA )
    Posts
    176

    Re: GMail Using OAuth 2.0

    G'Day vbLewis

    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

  5. #5

    Thread Starter
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    118

    Re: GMail Using OAuth 2.0

    Quote Originally Posted by couttsj View Post
    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.

  6. #6

    Thread Starter
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    118

    Re: GMail Using OAuth 2.0

    Quote Originally Posted by jg.sa View Post
    G'Day vbLewis

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width