2010-06-28 147 views
1

我使用Google App引擎和數據API構建了一個wiki。維基頁面被存儲爲Google Base'參考文章'。我希望用戶能夠查看,編輯和刪除項目,因此當向服務器發出請求時,客戶端登錄使用我的用戶名和密碼,並以用戶名義檢索或編輯數據。登錄代碼:401和403谷歌API錯誤

client = gdata.base.service.GBaseService() 
client.ssl = False 
gdata.alt.appengine.run_on_appengine(client) 

#EMAIL, API_KEY and PASSWORD are constants stored on the server 
client.email = EMAIL 
client.password = PASSWORD 
client.api_key = API_KEY 
client.ProgrammaticLogin() 

q = gdata.base.service.BaseQuery() 
q.feed = '/base/feeds/items/' + self.base_id 
item = base_client.GetItem(q.ToUri()) 

這工作對我很好,但如果我登出我的谷歌帳戶,它返回以下錯誤:

'status': 401L, 'body': '<HTML>\n<HEAD>\n<TITLE>Authorization required</TITLE> 

所有我想要的是爲用戶能夠以CRUD存儲在Base上的數據。我究竟做錯了什麼?
在此先感謝

回答

1

聽起來好像在您的客戶端註銷會使您的帳戶的所有會話無效。您最好的選擇可能是專門爲您的應用創建一個角色帳戶。