oAuth / oAuth2认证 [英] oAuth/oAuth2 Authentification
问题描述
嘿,
是否可以使用卡萨布兰卡通过oAuth2访问Google Calendar API?
我如何使用oAuth2验证,我再也没有获得访问令牌 - 所以我无法访问我的日历......
有没有例子如何使用卡萨布兰卡和oAuth / oAuth2认证?
提前致谢,
Ben
推荐答案
嗨Ben,
对于延迟回复表示歉意!是的,应该可以使用卡萨布兰卡的http_client来使用OAuth 2.0服务,例如Google API。
Sorry for delayed response! Yes, it should be possible to consume OAuth 2.0 services such as Google APIs using Casablanca's http_client.
显然,这不会像使用更高级别一样方便级别库(例如,用于.NET的DotNetOpenAuth),但它应该是可能的。我们可能会考虑在将来添加更高级别的API。
Obviously, this isn't going to be as convenient as using a higher-level library (such as DotNetOpenAuth for .NET), but it should be possible. We might consider adding a higher-level API in the future.
至于为什么你没有得到access_token - 我怀疑你的请求可能会格式错误。要解决这个问题,我会使用浏览器或Web调试器(如Fiddler)创建一个简单的请求,看看是否有效。接下来,使用http_client
执行相同操作,看看是否存在差异。
As to why you're not getting the access_token back -- I suspect your request might be malformed. To troubleshoot this, I would create a simple request using a browser or a web debugger such as Fiddler, and see if that works. Next, do the same using http_client and see if there is a difference.
这篇关于oAuth / oAuth2认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!