简体   繁体   English

Google Buzz和OAuth-重定向问题

[英]Google Buzz & OAuth - redirection problem

Hope this doesn't get too complicated. 希望这不会太复杂。 :) thing is.. :)事情是..

I'm trying to make my PHP code post notes to Google Buzz using OAuth as authentication mechanism. 我正在尝试使用OAuth作为身份验证机制,将我的PHP代码发布注释发布到Google Buzz。 I'm doing the typical "OAuth dance" (get request token, authorise it, exchange for access token), but i've ran into some problems that seem to be on Google's side. 我正在执行典型的“ OAuth跳舞”(获取请求令牌,对其进行授权,交换访问令牌),但是我遇到了一些问题,这些问题似乎在Google的一边。 Hope i'm wrong - it would be much easier to fix. 希望我错了-修复起来会容易得多。 :) :)

To get to the point - oauth_callback parameter doesn't seem to get passed to the authorization form. 直截了当-oauth_callback参数似乎没有传递到授权表单。 Authorization URI i'm redirecting to is like: 我重定向到的授权URI类似于:

https://www.google.com/buzz/api/auth/OAuthAuthorizeToken
?domain=<my.domain>
&scope=<urlencode(https://www.googleapis.com/auth/buzz)>
&oauth_token=<request_token>
&oauth_callback=<my.domain/callback>

When redirected, client is asked to authorize site to read/write from/to Buzz. 重定向后,会要求客户端授权网站对Buzz进行读写。 If accepted, Google asks again (but in different form) to allow access to .. after allowing for second time, success message is shown, but it doesn't return any tokens to my site, not redirecting to oauth_callback uri. 如果接受,则Google会再次请求(以其他形式)允许访问..在第二次允许后,显示成功消息,但它没有将任何令牌返回到我的网站,也没有重定向到oauth_callback uri。

Workaround i found is to manually add form field 'oauth_callback=' trough firebug/chrome inspector, and then, after these two confirmations it redirects to my site and i can extract authorized token from response, and exchange it for access token. 我发现的解决方法是通过Firebug / chrome检查器手动添加表单字段“ oauth_callback =”,然后在这两次确认后将其重定向到我的网站,并且我可以从响应中提取授权令牌,并将其交换为访问令牌。 If i use 'standard' Google's authorization endpoint, i get redirected correctly (one confirmation only), but then the access token i get after that is invalid for Buzz. 如果我使用“标准” Google的授权端点,则可以正确重定向(仅一个确认),但是之后获取的访问令牌对于Buzz无效。

So, am i wrong or google?! 所以,我错了还是谷歌? :D I've implemented OAuth for cooperation with some other services (Facebook, MySpace..) but i've never had this much trouble. :D我已经实现了OAuth与其他服务(Facebook,MySpace ..)的合作,但是我从来没有遇到这么多麻烦。

好的,当我第二天早上遇到问题时,(部分地)睁开眼睛,解决方案非常容易(但仍然没有记载)。:)以防其他人需要答案-请求请求令牌时应指定oauth_callback参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM