【问题标题】:google oauth2 grant_type=authorization_code returns Error processing OAuth 2 requestgoogle oauth2 grant_type=authorization_code 返回处理 OAuth 2 请求时出错
【发布时间】:2012-05-23 20:31:20
【问题描述】:

这段代码

帖子网址为https://accounts.google.com/o/oauth2/token

范围是“https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.google.com/m8/feeds/”

grant_type 作为授权码

代码来自谷歌

我的 %args = ( client_id => $config->{client_id}, client_secret => $config->{client_secret}, redirect_uri => $config->{redirect_uri}, 范围 => $config->{范围}, grant_type => $config->{grant_type}, 代码 => $代码, ); 我的 $ua = LWP::UserAgent->new; 我的 $ua_response = $ua->post( $uri, \%args );

我得到的是如下内容:(响应是 html 转义)

$VAR1 = \bless( {

'_content' => '  错误处理 OAuth 2 请求

错误处理 OAuth 2请求

错误500

', '_headers' => bless( { 'cache-control' => 'no-cache, no-store, max-age=0, must-revalidate', 'client-date' => 'Wed, 16 May 2012 09: 21:26 GMT', 'client-peer' => '173.194.74.84:443', 'client-response-num' => 1, 'client-ssl-cert-issuer' => '/C=ZA/O =Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA', 'client-ssl-cert-subject' => '/C=US/ST=California/L=Mountain View/O=Google Inc/CN=accounts .google.com', 'client-ssl-cipher' => 'RC4-SHA', 'client-ssl-warning' => '对等证书未验证', 'connection' => 'close', 'content-type ' => 'text/html; charset=UTF-8', 'date' => '2012 年 5 月 16 日星期三 09:21:21 GMT', 'expires' => '1990 年 1 月 1 日星期五 00:00:00 GMT', 'pragma' => 'no-cache', 'server' => 'GSE', 'title' => '错误处理 OAuth 2 请求', 'x-content-type-options' => 'nosniff' , 'x-frame-options' => 'SAMEORIGIN', 'x-xss-protection' => '1; mode=block' }, 'HTTP::Headers' ), '_msg' => '处理 OAuth 2 请求时出错', '_protocol' => 'HTTP/1.1', '_rc' => '500', '_request' => bless( { '_content' => 'grant_type=authorization_code&redirect_uri=http%3A%2F%2Fwww.xxx.com%2Foauth%2Fcallback%2Fgoogle&client_secret=xxx&client_id=xxx.apps.googleusercontent.com&code=4%2FSihUM4Zw1OPiWLMi- gdGvKOfiY4M.cggfQHKT31QagrKXntQAax3e4-qpbgI&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww。 google.com%2Fm8%2Ffeeds%2F', '_headers' => bless( { 'content-length' => 424, 'content-type' => 'application/x-www-form-urlencoded', 'user-agent' => 'libwww-perl/6.04' }, 'HTTP::Headers' ), '_method' => 'POST', '_uri' => bless(do{\(my $o = 'https://accounts.google.com/o/oauth2/token')}, 'URI::https' ), '_uri_canonical' => ${$VAR1}->{'_request'}->{'_uri'} }, 'HTTP::Request' ) }, 'HTTP::Response' );

实际上它有时有效,但并非适用于所有情况。

有什么问题吗?

【问题讨论】:

  • 实际上我们对失败进行了第二次请求,它修复了 70-80% 的百分比。不是全部。但更好。
  • 我遇到了类似的问题,我随机收到“错误处理 OAuth 2 请求错误 500”响应。它在开发过程中和在第三台服务器上运行良好。有没有人找到解决这个问题的方法?

标签: oauth


【解决方案1】:

在尝试为某些客户端获取访问令牌时,我们也面临同样的问题。这些客户的所在地是澳大利亚、日本、中国等,我们的服务器在德国。其他人也有同样的问题(https://groups.google.com/d/msg/google-content-api-for-shopping/Cx2hp8Ey5Sc/uBHqkwbTbXoJ),所以这个问题还没有解决,很遗憾......

【讨论】:

    猜你喜欢
    • 2015-07-06
    • 2023-01-17
    • 1970-01-01
    • 2015-12-31
    • 1970-01-01
    • 1970-01-01
    • 2019-07-11
    • 2020-10-09
    • 1970-01-01
    相关资源
    最近更新 更多