OAUTH2.0 GMAIL

Paul Mulroney pmulroney at logicaldevelopments.com.au
Mon Sep 23 23:23:14 UTC 2024


Hi Martin,

We did this recently for one of our clients.  They use gmail for their primary setup.

In the past, you could use the SMTP settings to send using Gmail's smtp server.  However, they started restricting how that was accessed in a bid to increase security. They then introduced "application specific passwords", which allowed you to create a password for your particular application that allowed you to send using Gmail's smtp server.  I'm not sure if that's an option any longer, I think that was discontinued in the recent past.  The only option to send email via Gmail is using the OAuth method.

To do that, you need to setup some stuff at Google's end to permit OAuth - what you're actually doing is accessing Google's Gmail APIs to send/receive email.  Here's the link to Google's documentation to do this: https://developers.google.com/identity/protocols/oauth2

It's a difficult thing to setup, but here are the basic steps:
- You need a google developer account.  It's been a while since we did this, but think if you have a google account you can just go to console.cloud.google.com <http://console.cloud.google.com/> and it should allow you do setup what you need
- Create a new google project
- Enable the "Gmail API"
- Create credentials - use the OAuth client ID option
-> this will give you a client ID and a client secret

Once you have these, the OAuth example in Omnis will work - you use the client ID and secret, it will ask you to sign into your google account and authorise, then redirect you back to your app.

We had a few false starts and did things out of sequence which required us to start over - 

If this all sounds too hard (and it is!) then you should consider using a mail service like SMTP2Go, or Twillio SendGrid - they allow you to send email via their service.  Again, there will be some setup required, but probably a lot less effort than google!

Regards,
Paul.



> On 23 Sep 2024, at 5:27 pm, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> 
> Hi all,
> Has anyone managed to setup smtpsend sample library with OAUTH2.0 with a gmail server?
> Question 1: When is it necessary to use Oauth with Gmail?Question 2: Which is the best sample libraries HTTP, IMAP, POP and SMTP to work with gmail?Question 3: Is there a way to setup a complete emailing utility with Omnis so that I can have sent items, incoming emails? Where can I get such a sample library? Or instead, it's just best to store emails in the database and mark them as either sent or pending?
> Any useful leads will be apprieciated.
> Kind regards,Martin Obongita.
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station..
-- 
Paul W. Mulroney                                            We Don't Do Simple Pty Ltd 
pmulroney at logicaldevelopments.com.au       Trading as Logical Developments
www.logicaldevelopments.com.au                   ACN 161 009 374 
Ph: +61 8 9458 3889                                       86 Coolgardie Street
                                                                         BENTLEY  WA  6102





More information about the omnisdev-en mailing list