2016-07-15 105 views
1

我有以下問題HybridAuth:PHP:Hybridauth重定向到HTTPS頁面

可以說,我開始在網頁「http://dev.EXAMPLE.COM/login.php」上。

我現在有以下腳本:

 require_once('hybridauth/config.php'); 
     require_once("hybridauth/Hybrid/Auth.php"); 
     $hybridauth = new Hybrid_Auth($config); 
     $adapter = $hybridauth->authenticate($provider); 
     $user_profile = $adapter->getUserProfile(); 

它應該只是重定向至Facebook /谷歌/ Twitter的,然後去HybridAuth的index.php,其中過程應該結束,然後重定向回我開始的頁面(「http://dev.EXAMPLE.COM/login.php」)。

我現在唯一的問題是,它重定向到「https:// ...」而不是「http:// ...」,這不起作用,因爲我沒有ssl證書在我的開發服務器上,所以瀏覽器只會顯示一個錯誤。

我該如何解決這個錯誤?如何將HybridAuth重定向到右側http:// ...頁面?

的config.php:

<?php 
    $config = array(
    "base_url" => "http://dev.XYZ.COM/hybridauth/", 
    "providers" => array (

     "Google" => array (
      "enabled" => true, 
      "keys" => array ("id" => "XYZ", "secret" => "XYZ"), 
     ), 

     "Facebook" => array (
      "enabled" => true, 
      "keys" => array ("id" => "XYZ", "secret" => "XYZ"), 
     ), 
    ), 
    "debug_mode" => false, 
    "debug_file" => "", 
); 

P.S:我也嘗試添加"trustForwarded" => 1到配置,但它也不管用。

回答

0

對於未來世界: 您可以通過手動

hybridauth->authenticate($PROVIDER, array("hauth_return_to" => "http://REDIRECT.URL")); 
設置重定向URL
相關問題