2012-12-05 44 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"); 
}