小编Uns*_*ged的帖子

Google OAuth 2.0"错误":"redirect_uri_mismatch"

我已经花了一天,撞了一杯,我真的很生气,我不明白谷歌想要什么,有什么不对.

我在开发者控制台中启用了Google+ Api google_ api已启用 ,创建了新的OAuth客户端ID 客户ID

    $ch = curl_init('https://accounts.google.com/o/oauth2/token');
curl_setopt($ch,CURLOPT_POSTFIELDS,'code=4%2FPp1GWqC6PIr3wNYrZ5kK4T9oitxBoo0fBqBrVNQfE-g.ElKDUjQ7E28SoiIBeO6P2m-0RPaolgI&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fmyprivatedomain.local.com%2Foauth2callback&client_id=%mycliet_id%&client_secret=%mysecret%');
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
var_dump(curl_exec($ch));
Run Code Online (Sandbox Code Playgroud)

在此处的说明中创建了所有内容:https://developers.google.com/+/web/signin/server-side-flow,gplus按钮显示在页面上,并成功请求授权用户访问.但是,当我执行第8 步时:初始化Google API客户端库并在 每次获得响应"错误"启动Google+服务我的请求:"redirect_uri_mismatch"

我知道,当您未在Google控制台中注册redirect_uri时,或者当您在其中输入类型错误时,会出现此错误,但我已将其注册,并且仅用于测试尝试设置不同的网址(更改的域名,更改的协议来自https到https),但它永远不会工作!我不知道还能检查什么,请至少建议一下.

oauth google-api-php-client google-oauth2

14
推荐指数
1
解决办法
6万
查看次数

如何在Go代码中编写方法和变量的内联文档?

是否有一些规则来记录GO语言中的方法和变量?

例如在php上

/**
 This method will increase parameter $b in 10 points
 @var int $b
 @return int

*/
public function someMethod($b){
    return $b+10;
}
Run Code Online (Sandbox Code Playgroud)

在GO上有类似的东西,或者我必须在上面的方法中只使用"// comment"而没有任何@var或@return?

documentation go

3
推荐指数
1
解决办法
2161
查看次数