【发布时间】:2012-04-25 09:00:27
【问题描述】:
我正在尝试形成一个 json 请求,以使用 oath2 规范进行身份验证以进行 Google 的“服务帐户”身份验证。我正在使用谷歌的文档here。它正在使用 JWT。似乎没有太多关于如何使用 C# 执行此操作的信息。这是我正在使用的 RAW json 请求,但我能从谷歌得到的唯一响应是“invalid_request”。
POST https://accounts.google.com/o/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: accounts.google.com
Content-Length: 457
Expect: 100-continue
Connection: Keep-Alive
{
"grant_type": "assertion",
"assertion_type": "http://oauth.net/grant_type/jwt/1.0/bearer",
"assertion": "JWT (including signature)"
}
对可能发生的事情有任何想法吗?我正在尝试创建一个 Windows 服务,以设定的时间间隔 ping 谷歌纬度位置?是否有另一种方法可以在不跳过这个环节的情况下访问该 API?谢谢!
【问题讨论】:
-
显然我正在用我自己计算的令牌替换“JWT(包括签名)”
-
看起来不像符合“application/x-www-form-urlencoded”的内容。那是json。
标签: c# .net google-api oauth-2.0 jwt