[snackr] r128 committed - Updated GoogleReaderSynchronizer to work with the new Auth token inste...

0 views
Skip to first unread message

codesite...@google.com

unread,
May 19, 2010, 2:27:36 PM5/19/10
to snackr-...@googlegroups.com
Revision: 128
Author: robadams
Date: Wed May 19 11:27:00 2010
Log: Updated GoogleReaderSynchronizer to work with the new Auth token
instead of the deprecated SID cookie. Does not yet handle CAPTCHA
challenges.
http://code.google.com/p/snackr/source/detail?r=128

Modified:
/trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as
/trunk/Snackr/src/model/feeds/readers/SynchronizerEvent.as
/trunk/Snackr/src/tests/GoogleReaderTester.as

=======================================
--- /trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as Mon
Jul 21 16:28:35 2008
+++ /trunk/Snackr/src/model/feeds/readers/GoogleReaderSynchronizer.as Wed
May 19 11:27:00 2010
@@ -60,7 +60,7 @@

private static const AUTH_BAD_CREDENTIALS_STATUS_CODE: Number = 403;

- private var _SID: String;
+ private var _authToken: String;
private var optionsModel:OptionsModel;

private var _connected: Boolean = false;
@@ -83,6 +83,7 @@
var variables: URLVariables = new URLVariables();
variables.service = "reader";
variables.source = SNACKR_CLIENT_ID;
+ variables.accountType = "GOOGLE";
variables.Email = login;
variables.Passwd = password;
authRequest.data = variables;
@@ -92,8 +93,8 @@
//manually parsing out the SID name/value pair
var tokens:Array = result.split(/[\n=]/);
for(var i:int = 0; i < tokens.length; i++) {
- if((tokens[i] == "SID") && (i+1 != tokens.length)) {
- _SID = tokens[i+1];
+ if((tokens[i] == "Auth") && (i+1 != tokens.length)) {
+ _authToken = tokens[i+1];
connected = true;
break;
}
@@ -154,12 +155,12 @@
}

private function getAuthenticationHeaders(): Array {
- var headers:Array = new Array(new URLRequestHeader("Cookie", "SID=" +
_SID));
+ var headers:Array = new Array(new
URLRequestHeader("Authorization", "GoogleLogin auth=" + _authToken));
return headers;
}

- public function get SID(): String {
- return _SID;
+ public function get authToken(): String {
+ return _authToken;
}

override public function getFeeds(callback: Function): void {
=======================================
--- /trunk/Snackr/src/model/feeds/readers/SynchronizerEvent.as Fri Jul 11
15:20:22 2008
+++ /trunk/Snackr/src/model/feeds/readers/SynchronizerEvent.as Wed May 19
11:27:00 2010
@@ -35,6 +35,7 @@
public static const AUTH_SUCCESS: String = "authSuccess";
public static const AUTH_BAD_CREDENTIALS: String = "authBadCredentials";
public static const AUTH_FAILURE: String = "authFailure";
+ public static const AUTH_CAPTCHA_CHALLENGE: String
= "authCaptchaChallenge";

public function SynchronizerEvent(type:String)
{
=======================================
--- /trunk/Snackr/src/tests/GoogleReaderTester.as Thu Jul 10 13:39:41 2008
+++ /trunk/Snackr/src/tests/GoogleReaderTester.as Wed May 19 11:27:00 2010
@@ -69,7 +69,7 @@

public function testAdd(): void {
_reader.addEventListener(SynchronizerEvent.AUTH_SUCCESS, function
callback(event: Event): void {
- Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.SID);
+ Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.authToken);
_reader.addFeed("http://rss.slashdot.org/Slashdot/slashdot");
});
_reader.authenticate("snackr...@gmail.com","l0lca+pr0n");
@@ -77,7 +77,7 @@

public function testDelete(): void {
_reader.addEventListener(SynchronizerEvent.AUTH_SUCCESS, function
callback(event: Event): void {
- Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.SID);
+ Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.authToken);
_reader.deleteFeed("http://rss.slashdot.org/Slashdot/slashdot");
});
_reader.authenticate("snackr...@gmail.com","l0lca+pr0n");
@@ -92,7 +92,7 @@

private function handleAuthSuccessTest(event: SynchronizerEvent): void {
Logger.instance.log("GoogleReaderTester.testAuthenticationSuccess: " +
(event.type == SynchronizerEvent.AUTH_SUCCESS), Logger.SEVERITY_NORMAL);
- Logger.instance.log("GoogleReaderTester: SID: " + _reader.SID);
+ Logger.instance.log("GoogleReaderTester: SID: " + _reader.authToken);
if(event.type != SynchronizerEvent.AUTH_SUCCESS) {
Logger.instance.log("GoogleReaderTester: testAuthenticationSuccess
failed: " + event, Logger.SEVERITY_DEBUG);
}
@@ -113,7 +113,7 @@

public function testGetFeeds(): void {
_reader.addEventListener(SynchronizerEvent.AUTH_SUCCESS, function
callback(event: Event): void {
- Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.SID);
+ Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.authToken);
_reader.getFeeds(function (feedlist: ArrayCollection): void {
Logger.instance.log("GoogleReaderTester: " + feedlist);
});
@@ -123,7 +123,7 @@

public function testGetReadItems(): void {
_reader.addEventListener(SynchronizerEvent.AUTH_SUCCESS,function
callback(event: Event): void {
- Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.SID);
+ Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.authToken);
_reader.getReadItems(function (itemList: ArrayCollection): void {
for each (var item:Object in itemList) {
Logger.instance.log("GoogleReaderTester: testGetReadItems: " +
item.guid + ", " + item.feedURL);
@@ -135,7 +135,7 @@

public function testSetItemRead(urlToRead:String, feedURLtoRead:
String): void {
_reader.addEventListener(SynchronizerEvent.AUTH_SUCCESS, function
callback(event: Event): void {
- Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.SID);
+ Logger.instance.log("GoogleReaderTester: Authentication successful,
SID: " + _reader.authToken);
_reader.getReadItems(function (itemList: ArrayCollection): void {
for each (var item:Object in itemList) {
Logger.instance.log("GoogleReaderTester: testSetItemRead: guid: " +
item.guid + ", itemURL: " + item.itemURL + ", feedURL: " + item.feedURL);

--
You received this message because you are subscribed to the Google Groups "snackr-dev-svn" group.
To post to this group, send email to snackr-...@googlegroups.com.
To unsubscribe from this group, send email to snackr-dev-sv...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/snackr-dev-svn?hl=en.

Reply all
Reply to author
Forward
0 new messages