OAUTH2.0 GMAIL

Joe Maus jmaus at theccgllc.com
Wed Oct 2 15:59:36 UTC 2024


Just a side note, the user account's password is not needed when using oAuth.

Second side note, if you end up using your SMTP worker object reference in a local variable, you'll probably want to set the $alwaysfinish() property to kTrue as otherwise the object ref may go out of scope before it has finished the sending of the email.  In addition, you may find your object sends email great when you step through the code, but suddenly stops working consistently when you stop stepping through the code, this situation is likely due to $alwaysfinish being set to kFalse (the default).

Regards,

Joe Maus

> On Sep 30, 2024, at 7:20 PM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> 
> Hooray! It has finally sent.
> You deserve a flower, Paul.
> Thank you so much for the leads.
> Regards, Martin.
> 
> 
> 
>    On Tuesday, October 1, 2024 at 02:15:45 AM GMT+3, Paul Mulroney <pmulroney at logicaldevelopments.com.au> wrote:  
> 
> Hi Martin,
> Just a double check - the username and password on the front screen of the sample must have username which is the full gmail address eg <username>@gmail.com?
> If you get the authorise part OK, it's got to be something like this.
> RegardsPaul.
> 
> 
> 
> On 30 Sep 2024, at 4:48 pm, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> Hi Paul,
> I hope you are fine.
> I followed your instructions given below and the smtp authorizes and logs in to my GMAIL and is able to start the process.  But I get errors in the result tab with error code 67 error info "login denied". The error log says, username and password not accepted. Yet I have counter checked & with confirmation the password and user are correct.
> We are almost there. Any further help on error 67?
> Regards,Martin.
> 
> 
> 
> 
>    On Thursday, September 26, 2024 at 11:35:41 AM GMT+3, Paul Mulroney <pmulroney at logicaldevelopments.com.au> wrote:  
> 
> Hi Martin,
> Are you talking about the SMTP OW3 Worker sample library?  If so, then going from memory I think that the sequence is:- Open the window (if you currently have it open, then close it)- Check "Use OAuth2"- Click the "OAuth2" tab- Enter Client ID, Client Secret, (you need to set these up in the Google Developer Console)- Enter Authorisation URL (eg https://accounts.google.com/o/oauth2/v2/auth), Access Token URL (eg https://oauth2.googleapis.com/token), Scope (eg https://mail.google.com/)- Go back to the "Server connection" tab- Click "Authorize" -> this should open a browser window where you sign onto Google and allow you authorise to send- Click the "Server connection" tab again- Enter your from email address (username) and email password- Click on the "message" tab and enter from/to- Click on the "subject" tab and enter the message body- click "Start".
> I know that you if you click Start first and then try to authorise it gets upset.  I just stepped through these instructions and they seemed to work for me - Studio 10.22 build 31896.
> RegardsPaul.
> 
> On 26 Sep 2024, at 12:19 am, Martin Obongita <martin.obongita at yahoo.com> wrote:
> Hi all,
> I have managed to get the clientID, clientSecret and the accessToken for the OAUTH2. I update the entry fields. I then mark on Use AUTH2 then click on Authorize button. I get the error authorize() cannot run while the OAUTH2Worker object is assigned to the $aouth2 property of an OW3 worker.
> 
> Where can I get the $aouth2 property? Where can I get the OAUTH2 object class?
> 
> Regards
>  
> 
> 
> 
> 
> 
> 
>    On Tuesday, September 24, 2024 at 02:23:30 AM GMT+3, Paul Mulroney <pmulroney at logicaldevelopments.com.au> wrote:  
> 
> 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 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 
> 
> 
> 
> 
> Fishing is a matter of Bait and Sea @gingermeggs1921
> -- 
> 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
> 
> 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 
> 
> I'm riding in the month of October to raise funds for the Royal Flying Doctor Service.  Would you help me support this worthy cause?  You can donate here: https://www.oceanstooutback.org.au/fundraisers/paulmulroney
> 
> 
> 
> |    | Paul W Mulroney
> Logical Developments
> Customised Software Solutions
> Ph: 08 9458 3889
> |    | We Don't Do Simple Pty Ltd
> trading as
> Logical Developments
> ACN 161 009 374
> |
> |   |        |
> 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list