私は "Googleでログイン"機能を備えたWindows phone 7アプリを構築しました。 GoogleライブラリはWindows Phone Runtimeと互換性がないため、RestSharpを選択します。Google認証にRestSharpを使用するには?
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?
は、私はGoogleからの応答を取得するためにclient.ExecuteAsync<T>
方法(または任意の他は、参考になる)を使用するかどうかはわかりません。そのような方法を使用するために私に事前に要求されている他のコードはありますか?誰か助けてくれますか?
私の問題は、他のコードが実行されているとコールバックが呼び出されないようなことです。これは良い解決策です、ありがとう! – yifei
また、アクション内のコードはディスパッチャにラップされ、UIスレッド上でラップされる必要があります。 'client.ExecuteAsync(request、(response)=> { Deployment.Current.Dispatcher.BeginInvoke(()= > { myResponseTextBox.text = response.Content; }); }); ' – Chewbarkla