【发布时间】:2014-03-03 04:24:40
【问题描述】:
我在我的网站上使用 HybridAuth 2.1.2 进行社交登录,通过 Yii 框架实现。
Facebook 可以正常运行。我在使用 Google 等其他登录方式时遇到了问题。
HybridAuth 将用户重定向到以下 URL:
https://accounts.google.com/o/oauth2/auth?client_id=XXXCLIENTIDXXX&redirect_uri=http%3A%2F%2Fwww.XXX.de%2Fsociallogin%3Fhauth.done%3DGoogle&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=online
如果我在 HybridAuth/hybridauth-2.1.2/Hybrid/Providers/Google.php 中回显重定向 url,我会得到这个 url:
https://accounts.google.com/o/oauth2/auth?client_id=XXXCLIENTXXX&redirect_uri=http%3A%2F%2Fwww.XXX.de%2Fsociallogin%3Fhauth.done%3DGoogle&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=online
谷歌.php:
[...]
echo $this->api->authorizeUrl( $parameters );
return true;
Hybrid_Auth::redirect( $this->api->authorizeUrl( $parameters ) );
}
问题是我认为的 & 符号。任何想法如何抑制 redirect() 以生成加密 URL?
【问题讨论】:
-
htmlspecialchars_decode()将变回 &到 & -
是的。但是 header() 函数在没有编码字符的情况下获得了正确的 url。在我当地的开发环境中,它可以工作。哪个php设置对此负责? default_charset?
标签: php yii oauth-2.0 hybridauth