Calendar
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Recent Entries
Come On In, Rails-The Water's Warm
Shan's Simple Examples: File uploads with Flex and ColdFusion
Recent Comments
Google Calendar API - Creating a new Calendar with ColdFusion
Steve Julian said: When and where are you going to post the finished CFC's ? Thanks
[more]
Three Phases of Programmer Development
Pat Branley said: I normally think of those phase 2 people as 'programmers' and the phase 3 people as 'developers'.
I...
[more]
New Job Title: Front End Engineer
Sean Corfield said: Well, there's always the excellent Fusion Authority Quarterly Journal...
[more]
Down To The Wire: HTTP Sniffers
Brian M said: I second the mention of the Charles Web Debugging Proxy that Tariq mentioned. It is fantastic. It s...
[more]
New Job Title: Front End Engineer
Patrick said: Heya Sean. Good point. I never understood how they did things over there at SysCon, and I understand...
[more]
Archives By Subject
Business of Software (4) [RSS]
ColdFusion (318) [RSS]
Conferences (6) [RSS]
Databases (87) [RSS]
Flex & Flash (109) [RSS]
Fusebox (87) [RSS]
General Development (29) [RSS]
Google (9) [RSS]
Hardware (5) [RSS]
JVM & Java (132) [RSS]
Linux (20) [RSS]
Miscellaneous (254) [RSS]
Performance (8) [RSS]
SeeFusion (36) [RSS]
Shan's Simple Examples (7) [RSS]
User Interface (3) [RSS]
Windows (5) [RSS]
Archives By Poster
Daryl Banttari (10)
Nat Papovich (29)
Patrick Quinn (36)
Shannon Hicks (22)
Steve Nelson (21)
Tyson Vanek (3)
Google API: Logging in with AuthSub Part 2
The first step of the AuthSub proxy process is very simple. Which is good. It'll ease you into using the Google API. Below is the first function in my GoogleAuthenticate.cfc file. I'll publish the full file after I cover the individual functions. Feel free to build the CFC and follow along. Basically all you need to do is start with a file called GoogleAuthenticate.cfc, throw in some cfcomponent tags, then add the functions as I post them.
<cfargument name="next" type="string">
<cfargument name="scope" type="string">
<cfargument name="secure" type="string">
<cfargument name="session" type="string">
<cflocation url=" https://www.google.com/accounts/AuthSubRequest?next=#urlencodedformat(arguments.next)#&scope=#urlencodedformat(arguments.scope)#&session=#iif(arguments.session,1,0)#&secure=#iif(arguments.secure,1,0)#" addtoken="No">
</cffunction>
In a nutshell it is one line of code. It's a cflocation. The two arguments to pay attention to are next and scope.
Next is the URL that Google will send the user back to after they login to google.com and accept your request to access their Google data. When you make use of this API you'll need to have the next attribute point to one of your own CFM page. Something like: http://www.yourdomain.com/whatever.cfm then in that whatever.cfm file you you need to save the #url.token# variable that Google returns to you.
Scope is a little simpler. Basically if tells Google which part of the API you want to access. I get the feeling there are LOT of 'scopes' (or eventually there will be a lot) but I have only found 3 so far:
1) http://spreadsheets.google.com/feeds
2) http://www.google.com/calendar/feeds
3) http://picasaweb.google.com/data/feed/api/user/victor.coustenoble?kind=album
I have tried the calendar and spreadsheet and it works great. I haven't tried the picasaweb (photo uploads)
Secure is either 1 or 0 I haven't even played with secure tokens. If anyone reading this has, explain the difference.
Session is also either 1 or 0 I've been setting session=1 because it allows you to save the token in a database and automatically log them back in later. It's a little more complex. In a nutshell you take this token, and get ANOTHER token called a subsession token. I'll explain that in another post.
So if you put this code into a file called: GoogleAuthenticate.cfc with cfcomponent tags. Here's an example in action:
<cfinvokeargument name="next" value="http://127.0.0.1/next.cfm">
<cfinvokeargument name="scope" value="http://spreadsheets.google.com/feeds">
<cfinvokeargument name="secure" value="0">
<cfinvokeargument name="session" value="1">
</cfinvoke>
-Steve Nelson


There are no comments for this entry.
Add Comment