2012-12-05 47 views
0

出於畢業文章的目的,我正在開發Picasa API的Windows Phone應用程序客戶端,而不使用任何庫。Picasa API中的OAuth 2.0請求

我能夠做到這裏列出的第5個步驟:https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol#Auth

但我怎麼做步驟6「附加令牌請求」? 您的應用程序請求用戶數據,將訪問令牌附加到請求。

我嘗試使用HTTP頭認證:承載[訪問令牌]和查詢字符串=的access_token [令牌]

兩人都沒有工作。

回答

0

如果你在這裏發佈你的代碼會有幫助,但基本上querystring?access_token =應該工作。您是否使用客戶端或服務器端身份驗證?

服務器端認證實際上有一個額外的步驟。您需要將「代碼」換成「代幣」。

之後,它只是在查詢字符串中插入訪問令牌。我有一個積極的工作項目,有這個WCF合同簽名:

[ServiceContract] 
public interface IPicasaWeb 
{ 
    [OperationContract] 
    [WebInvoke(UriTemplate = "data/feed/api/user/{userId}?kind=photo&alt=json&access_token={accessToken}&max-results={perPage}&start-index={startIndex}&access={access}", 
     ResponseFormat = WebMessageFormat.Json, 
     RequestFormat = WebMessageFormat.Json, 
     BodyStyle = WebMessageBodyStyle.Bare, 
     Method="GET")] 
    Photos GetPhotos(string userId, string accessToken = null, int startIndex = 1, int perPage = 30, string access = "visible"); 
}