Google 日历数据 API 集成
我们使用 Oauth 来获取日历事件数据。我已成功授权令牌并将其兑换为访问令牌。当我对 API 端点执行 get 请求时,我会看到一个显示“暂时移动”的页面,其中包含指向类似 https://www.google.com/calendar/feeds/default?gsessionid=xxxxxxxxxxxx
我想解释响应,无论是 json 还是 xml,但我无法获取超出了它抛出的重定向范围。知道如何遵循吗?
这是我对 feed 的调用:
access_token = current_user.google.client
response = access_token.get(ConsumerToken::GOOGLE_URL).body
We're using Oauth to grab Calendar event data. I have successfully authorized the token and exchange it for an access token. When I perform a get request to the API endpoint I get a page that says "Moved Temporarily" with a link to something like https://www.google.com/calendar/feeds/default?gsessionid=xxxxxxxxxxxx
I'd like to interpret the response, whether it's json or xml but I can't get beyond the redirect it's throwing out. Any idea how to follow this?
Here's my call to the feed:
access_token = current_user.google.client
response = access_token.get(ConsumerToken::GOOGLE_URL).body
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,我自己刚刚处理了这个问题。它说“暂时移动”,因为它是一个重定向,不幸的是,oauth gem 不会自动遵循该重定向。你可以做这样的事情:
这可能值得打补丁...
Yep, just dealt with this myself. It says "Moved Temporarily" because it's a redirect, which the oauth gem unfortunately doesn't follow automatically. You can do something like this:
This might be worthy of a patch to oauth...