Open GoogleCodeExporter opened 8 years ago
I found the problem and here's a simple solution. According to Federated Login
docs, there's a NOTE: "If you request an OAuth token and none is returned, if
may be because you've previously acquired an access token keyed to the specific
user and scope. For privacy considerations, Google expects third-party
applications to store OAuth tokens, which are long-lived, rather than request a
new token every time the application needs to access the user's Google
service.".
The issue is that when the page is reloaded after the OpenID+OAuth process has
completed (so the request token is set as a URL parameter
'openid_ext2_request_token'), then the page re-attempts to get the access
token. Since the access token isn't returned, the remaining code breaks around
the regex parsing to construct a new OAuthToken in getAccessToken(). The
simplest workaround is to store the access token as a session variable. The
access token is an instance of OAuthToken and is not serializable as php
session variable, so you need to store the access key's "key" and "secret"
properties instead. Here's how:
Change the following (around line 105 in index.php):
$access_token = getAccessToken($request_token);
Instead:
if(isset($_SESSION["access_token_key"])) {
$access_token = new OAuthToken(urldecode($_SESSION["access_token_key"]),
urldecode($_SESSION["access_token_secret"]));
} else {
$access_token = getAccessToken($request_token);
$_SESSION["access_token_key"] = $access_token->key;
$_SESSION["access_token_secret"] = $access_token->secret;
}
Original comment by burkes...@gmail.com
on 14 Jul 2010 at 2:10
Here is error I got, any idea ? it came out after I granted
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message
'Expected response code 200, got 500 Internal Error' in
/home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata/App.php:709 Stack
trace: #0 /home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata.php(219):
Zend_Gdata_App->performHttpRequest('GET', 'http://spreadsh...', Array, NULL,
NULL, NULL) #1
/home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata/App.php(875):
Zend_Gdata->performHttpRequest('GET', 'http://spreadsh...', Array) #2
/home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata/App.php(763):
Zend_Gdata_App->get('http://spreadsh...', NULL) #3
/home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata/App.php(205):
Zend_Gdata_App->importUrl('http://spreadsh...', 'Zend_Gdata_Spre...', NULL) #4
/home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata.php(162):
Zend_Gdata_App->getFeed('http://spreadsh...', 'Zend_Gdata_Spre...') #5
/home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata/Spreadsheets.php(150):
Zend_Gdata->getFeed('ht in
/home/michael/tmp/ZendFramework-1.11.0/library/Zend/Gdata/App.php on line 709
Original comment by m...@ask-cs.com
on 30 Dec 2010 at 2:16
Original issue reported on code.google.com by
roma...@gmail.com
on 8 Apr 2010 at 7:22