2

servicestack で Google oauthprovider を作成しようとしましたが、少し問題があります。(私は、ここで Google の説明に従っています。Using OAuth 2.0 for Web Server Applications

https://accounts.google.com/o/oauth2/authから(正しいと思われる)コードを取得していますが、応答を処理しようとすると(これを使用して:)

var tmp = "client_id={0}&redirect_uri={1}&client_secret={2}&code={3}&grant_type=authorization_code".Fmt(this.ConsumerKey, this.CallbackUrl, this.ConsumerSecret, code);
var contents = "https://accounts.google.com/o/oauth2/token".PostToUrl(tmp, "application/x-www-form-urlencoded");

400 Bad Request が返ってきます。フィドラー (URL を http に変更) を見ると、次のように表示されます。

POST http://accounts.google.com/o/oauth2/token HTTP/1.1
Accept: application/x-www-form-urlencoded
Host: accounts.google.com
Content-Length: 239
Expect: 100-continue

client_id=280348863874-ANDSOMEMOREDATase.apps.googleusercontent.com&
redirect_uri=http://localhost:49492/api/auth/google&
client_secret=NVHANDSOMEMOREDAT&
code=4/TWHupGxEXBQANDSOMEMOREDATA&
grant_type=authorization_code

これはドキュメントに記載されている内容とうまく一致しているようですが、なぜBad Requestなのですか?

私は本当にここで立ち往生しています。助けてくれてありがとう!

ラルシ

4

0 に答える 0