3 messages in com.googlegroups.bloggerdevStrange 401s| From | Sent On | Attachments |
|---|---|---|
| laptoplover | 15 Mar 2008 01:26 | |
| Jeff Scudder | 17 Mar 2008 15:32 | |
| laptoplover | 20 Mar 2008 04:37 |
| Subject: | Strange 401s![]() |
|---|---|
| From: | laptoplover (geor...@gmail.com) |
| Date: | 03/15/2008 01:26:03 AM |
| List: | com.googlegroups.bloggerdev |
So, I finished building my application and it went through testing fine. However recently I've been getting 401 responses when trying to retrieve feeds. Now I know that this is an authentication error response, but it only started appearing recently. I tried forcing all my users to sign in again in case the session key had expired, but they still reported the same error immediately.
http://www.blogger.com/feeds/default/blogs works fine, but whenever I use http://www.blogger.com/feeds/blogID/posts/default this error appears, whether the user is trying to view their own blogs or friends blogs.
I store the session tokens in a mysql database, and I've checked that the key is successfully put into the database. I've also checked the retrieval of this key and it appears to be fine.
The code I use to authenticate is:
$sql = "SELECT * FROM blogger_details WHERE user = '$user'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
//if user is not logged into aplication
if($row === false){
//if user has just logged into Google
if($_GET['token']){
$btoken = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
$sql = "INSERT INTO blogger_details (user, google) VALUES ('$user', '$btoken');";
mysql_query($sql) or die ('Query failed: '.mysql_error());
}elseif (!$_GET['token']){ //ask user to log into google
$url = "https://www.google.com/accounts/AuthSubRequest? next=myapp&scope=http://www.blogger.com/feeds/ default&secure=0&session=1";
echo 'You are not currently logged in.<br>';
print "<a href=\"$url\">Login to your Google account</a>" ;
echo '<br><br>';
die;
}
}else{
$btoken = $row['google'];
}
$gClient = Zend_Gdata_AuthSub::getHttpClient($btoken);
$gData = new Zend_Gdata($gClient);
I'm a bit confused as to why this stopped working. One day it was fine, the next my testers were emailing me saying they couldn't see their posts, their friends posts, or publish/save posts. :(




