2013-08-26 67 views
1

我一直試圖使hybridauthYii中的工作與hybridauth extensionyii中的Hybridauth將不會重定向到谷歌

問題是,當我想使用谷歌簽名時,它只是將我重定向到http://mywebsite.com/site/login

我正在使用htaccess從路徑中刪除「index.php」,並且還將index.html設置爲默認值(因爲我只測試yii並且不想顯示它)看起來是這樣的:

DirectoryIndex index.html index.php 
RewriteEngine on 
# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# otherwise forward it to index.php 
RewriteRule . index.php 

Hybridauth擴展到config/main.php在模塊部分,其配置是這樣的:

'hybridauth' => array(
     'baseUrl' => 'http://'. $_SERVER['SERVER_NAME'] . '/hybridauth', 
     'withYiiUser' => false, // Set to true if using yii-user 
     "providers" => array (
      "google" => array (
       "enabled" => true, 
       "keys" => array ("id" => "xxxxxxxxxxxx.apps.googleusercontent.com", "secret" => "xxxxxxxxxxxxxxxxxxxxxxxx"), 
       "scope" => "" 
      ) 


     ) 
    ), 

在谷歌控制檯我創建客戶端ID爲web應用程序,重定向的URI是這個:

http://mywebsite.com/hybridauth/default/callback?hauth.done=google 

我發現this

您的配置文件BASE_URL 「hybridauth.php」 應設置爲 「/ hauth /終點」,即它必須指向端點。如果您通過.htaccess刪除index.php ,然後使用 「/index.php/hauth/endpoint」。

我試着將config中的baseUrl設置爲http://'. $_SERVER['SERVER_NAME'] . '/index.php/hybridauth,但沒有運氣。什麼可能是錯的?

回答

0

我忘記了我已經將srbac模塊的調試屬性設置爲false,因此未經授權的用戶無法訪問hybridauth。 hybridauth必須允許在srbac模塊中,以便每個人都可以訪問它。

編輯: 我找不到srbac控制面板中的hybridauth模塊,我剛將它添加到allways允許列表中,請參閱我的回覆here

相關問題