我正在尝试设置Hybridauth 3 Twitter和Google登录名:
我遇到的问题是页面返回空白并挂在“ process_sign_up.php”中。我一辈子都想不出办法解决这个问题。搜索主题时,我已经查找了多个线程。我尝试将session_start()添加到顶部..没有运气
process_sign_up.php:
if ($_REQUEST['provider']) {
// Social Login
// the selected provider
$provider_name = $_REQUEST["provider"];
//Include Hybridauth's basic autoloader
include 'hybridauth3/src/autoload.php';
if ($provider_name == "twitter") {
$config = [
'callback' => 'https://www.example.com/process_sign_up.php',
'keys' => [ 'key' => 'keyhere', 'secret' => 'secrethere' ]
];
try {
$twitter = new Hybridauth\Provider\Twitter($config);
$twitter->authenticate();
$accessToken = $twitter->getAccessToken();
$userProfile = $twitter->getUserProfile();
print_r($accessToken);
print_r($userProfile);
}
似乎永远不会过去
$twitter->authenticate();
上面的代码执行完后,我将重定向到带有以下参数的回调URL:
?oauth_token=H5IIfwAAbbA6rviAAABaFJ2_bs&oauth_verifier=HATimlasfdsdfLe0sclYB81Lptaufha2
但是页面挂在回调URL上。
该如何解决?我缺少明显的东西吗?