我已经建立了一个“用谷歌登录”功能的Windows Phone 7应用程序。 Google库与Windows Phone运行时不兼容,所以我选择了RestSharp。如何使用RestSharp进行Google身份验证?
该应用已成功收到来自Google的验证码,下一步是交换访问令牌和刷新令牌的代码。在这里我遇到了一些问题。
var request = new RestRequest(this.TokenEndPoint, Method.POST);
request.AddParameter("code", code);
request.AddParameter("client_id", this.ClientId);
request.AddParameter("client_secret", this.Secret);
request.AddParameter("redirect_uri", "http://localhost");
request.AddParameter("grant_type", "authorization_code");
client.ExecuteAsync<???>(request, (response) =>
{
var passIn = response;
}); // how to use this method?
我不知道如何使用client.ExecuteAsync<T>
方法(或任何其他的将是有益的),以获得从谷歌的反应。是否有任何其他代码需要我使用这种方法?有谁能够帮助我?
我的问题是,如果正在执行一些其他代码,则不会调用回调。这是一个很好的解决方案,谢谢! – yifei 2012-03-11 15:55:17
此外,操作中的代码应该包装在调度程序中,以便它在UI线程上执行。 'client.ExecuteAsync(request,(response)=> {012;}} {} {} > { myResponseTextBox.text = response.Content; }); });'' – Chewbarkla 2012-03-30 01:39:16