OAuth2 accessing Google Mail and Contacts

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Hans-Helmut
Posts: 57
Joined: Sat Jan 14, 2017 6:44 pm

OAuth2 accessing Google Mail and Contacts

Post by Hans-Helmut » Fri Feb 24, 2017 3:12 pm

I am working using Window 10.
OAuth is the standard protocol for authorization
OAuth 2 is the latest such protocols allowing an application to use the API (application programming interface) to gain access to other services such as Google, Dropbox, Microsoft, Apple, etc.)

I had some progress and some hard time figuring out certain ways of accomplishing what I want to do using Livecode. Nevertheless, even though not everything is so clear, generally it is a very easy language to use. So, a big hope for a future bright ).

For now, I feel stuck using integrating email. It is beyond my current skill.

As part of a business application that I like to offer to my customers, and still LEARNING Livecode, I want to make it possible to send email from Livecode, receiving email in Livecode and manage projects and tasks regarding email and other channels customers like to use for any kind of communication.

Now, I read that there is a OAuth2 library for Livecode now (I have not really started this yet, but better asking before spending hours and days). I want to use project labels that are generated in Livecode and use these labels when email is sent using Google Mail (Gmail). So, sending mail using the standard way does not help, because these labels (multiple folders) can not be used. I need a direct access to Gmail. And also to the contacts in Gmail.

And the other way around, I want to be able to download mail from Gmail, but also keep the associated labels and not lose them.

The difference in Gmail compared to other email clients is that there are no folders to store email messages, but there are tags or "labels" associated which appear like folders. This means a message can have none, one or more such labels (or tags, or folders), and a label can have none, one or many messages.

What direction must I take to develop realizing this? Any helpful starters advice would be most appreciated.

As I understand, the specific OAuth2 Google API has to be used, and only then it seems possible to do what is in my mind. SMTP server and receiving email using IMAP does not seem to work here.

For storing I am currently using SQLite, but it will be remote database management system soon.

Are there any experiences already? How to approach this task the best way?

(P.S: Ideally I would very appreciate seeing sophisticated and well-documented examples of accessing a number of services using OAuth2, or some kind of "templates".)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: OAuth2 accessing Google Mail and Contacts

Post by jacque » Sat Feb 25, 2017 5:22 pm

Writing an email client is a fairly big undertaking and not something I can help with. But the oauth library is included in the Indy and Business licenses and looks easy to use. You first need to register with Google as a client and receive app credentials.

LiveCode has a command that will send email but I think you will need to write your own scripts to receive and parse incoming email. The Internet libraries are robust but you will probably have to do much of the retrieval using the more detailed and low-level commands. If you have familiarity with email protocols it should be doable.

Since you're new to LC you might want to start with something simpler just for practice.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Hans-Helmut
Posts: 57
Joined: Sat Jan 14, 2017 6:44 pm

Re: OAuth2 accessing Google Mail and Contacts

Post by Hans-Helmut » Sun Feb 26, 2017 10:12 am

Jacqueline Landman Gay:
Writing an email client is a fairly big undertaking and not something I can help with. But the oauth library is included in the Indy and Business licenses and looks easy to use. You first need to register with Google as a client and receive app credentials.
I am not sure if your words are discouraging or challenging to try it nevertheless ). The same with my other notes about "Excel made in Livecode" - which is a challenging idea looking at what could be possible using Livecode and where are the limits. And I can take many other examples. (There, at least, I am working now on a subset of a subset of Excel-like features, and if successful, I will publish it for review).

http://forums.livecode.com/viewtopic.ph ... el#p151307

I will soon upgrade to Indy or Business to get the OAuth2 library. It is worth it as it seems to be needed everywhere now.

And actually, I hope that there are templates or examples for all the major APIs which people use since it is a big part of today's world: accessing user data anywhere. We all learn best from well-documented examples.

Professional development

My concern is professional development. I do not see that in my lifetime I will start to become a hard-core developer spending at least 4 hours daily developing. I must understand enough to give the work to other developers to do the main work.

I do not want Livecode to just be a nice hobby for some in-house quick-and-dirty solutions -- even though currently I am using it for just this. I would really like to see it as a professional tool for the development of professional applications which go to the international markets and are recognized as being professional on all the supported platforms. :D

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: OAuth2 accessing Google Mail and Contacts

Post by FourthWorld » Sun Feb 26, 2017 6:29 pm

Hans-Helmut wrote:I will soon upgrade to Indy or Business to get the OAuth2 library. It is worth it as it seems to be needed everywhere now.
While there are many benefits for using the Indy and Business packages, and of course those are needed for delivering proprietary apps, the OAuth2 library is included in LC Community Edition v9 and later.
And actually, I hope that there are templates or examples for all the major APIs which people use since it is a big part of today's world: accessing user data anywhere. We all learn best from well-documented examples.
This may help:
http://lessons.livecode.com/m/2592/l/67 ... h2-library

The Oauth library is a new addition to the LiveCode family, so it'll be some time yet before we see more tutorials and examples for it. That said, it is of course a very useful addition and will benefit a great many users, so while we get more tutorials in place feel free to post any questions you have here in the forums so we can all benefit from the knowledge shared.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Hans-Helmut
Posts: 57
Joined: Sat Jan 14, 2017 6:44 pm

Re: OAuth2 accessing Google Mail and Contacts

Post by Hans-Helmut » Sun Mar 05, 2017 10:30 am

Thank you again, Richard and all.

This OAuth2 still drives me crazy. I think I need a couple of days time to really get involved understanding the underlying concept and the way of how it is implemented using LC. I am still on the Community addition and will try to get something working using LC 9... latest built.

Just wanted to thank everyone.

Hans-Helmut

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”