我一直試圖使hybridauth在Yii中的工作與hybridauth extension。yii中的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
,但沒有運氣。什麼可能是錯的?