Gmail Contacts Data API access with ColdFusion

I've been looking at accessing the Gmail contact data via their API. This is the first draft of my findings and is no way the finished solution but it does what it says on the tin and returns the email address's from a users Gmail account contacts. Its actually quite simple to and we're going to do this in 2 CFM pages.

We are going to be using the AuthSub method of registration

There are three levels of registration:
  1. Unregistered: Application is not recognized by Google. The Access Request page, which prompts your users to either grant or deny access for your application, displays this caution highlighted in yellow: "Non-registered, not secure. This website has not registered with Google. We recommend that you continue the process only if you trust this destination."
  2. Registered: Application is recognized by Google. The Access Request page displays this caution: "Registered, not secure. This website is registered with Google to make authorization requests, but has not been configured to send requests securely. We recommend you continue if you trust this destination."
  3. Registered with enhanced security: Registered applications with a security certificate on file can use secure tokens. The Access Request page displays this message: "Registered, secure. This website is registered with Google to make authorization requests."

As we are going to be using the first method of Unregistered the user will getting some simple/basic prompts:

  1. The first will be asking them to log in and letting them know that "A third party service is requesting permission to access your Google Account"
  2. Second an Access Request page which lets the user know WHAT we are doing

Posted: 22-May-2008

View: 5761

Permalink: here

Comments

This is really nice functionality Andy. Since you wrote this quite a while ago, I was wondering if you've expanded upon it or come across anyone who has.

Basically what I'm looking for is the best way w/ CFML to grab my users contacts from Gmail, Yahoo, Hotmail, etc.

Thanks for your help!
Brian

#1 Brian
30/Sep/09 7:59 PM

2 things:

1) When I do this method, occasionally this returns a "you do not have cookies enabled" when i clearly do. Any ideas on how this is happening/how to deal with it?

2) Has anyone done this with Oauth? I'm struggling on the final step (retrieving the contacts)

#2 Great Dental Websites
19/Jul/11 8:21 PM

Brian,

If you still need it, I have the code for Yahoo and most of it written for hotmail (they disabled retrieving email addresses, instead you have to send messages via their API)

#3 Great Dental Websites
19/Jul/11 8:34 PM

I understand your logic on this, well this is very interesting indeed.Would love to read a little more of this. Great post. This blog was very informative and knowledgeable thanks for sharing with us.
http://www.city32.com/87/posts/2_Media/2_Newspaper...

#4 Gallatin News
12/Aug/11 2:38 PM

Thanks for your sharing.

I tried to use your code and modified to get list docs. But i got an error "<HTML> <HEAD> <TITLE>Token invalid - Invalid AuthSub token.</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Token invalid - Invalid AuthSub token.</H1> <H2>Error 401</H2> </BODY> </HTML> "

Do you know why?

#5 Duc
13/Aug/11 7:20 AM