を失敗し、私のコントローラ機能があるHybirdAuthユーザープロファイル要求は
としてpublic function loginwith($provider) {
// $this->autoRender = false;
require_once(WWW_ROOT . 'hybridauth/Hybrid/Auth.php');
$hybridauth_config = array(
"base_url" => 'http://' . $_SERVER['HTTP_HOST'] . $this->base . "/hybridauth/", // set hybridauth path
"providers" => array(
"Google" => array(
"enabled" => true,
"keys" => array("id" => "clientID", "secret" => "clientSecret")
)
)
);
try {
// create an instance for Hybridauth with the configuration file path as parameter
$hybridauth = new Hybrid_Auth($hybridauth_config);
// try to authenticate the selected $provider
$adapter = $hybridauth->authenticate($provider);
// grab the user profile
$user_profile = $adapter->getUserProfile();
debug($user_profile);
} catch (Exception $e) {
// Display the recived error
switch ($e->getCode()) {
case 0 : $error = "Unspecified error.";
break;
case 1 : $error = "Hybriauth configuration error.";
break;
case 2 : $error = "Provider not properly configured.";
break;
case 3 : $error = "Unknown or disabled provider.";
break;
case 4 : $error = "Missing provider application credentials.";
break;
case 5 : $error = "Authentification failed. The user has canceled the authentication or the provider refused the connection.";
break;
case 6 : $error = "User profile request failed. Most likely the user is not connected to the provider and he should to authenticate again.";
$adapter->logout();
break;
case 7 : $error = "User not connected to the provider.";
$adapter->logout();
break;
}
// well, basically you should not display this to the end user, just give him a hint and move on..
$error .= "Original error message: " . $e->getMessage();
$error .= "Trace: " . $e->getTraceAsString();
$this->set('error', $error);
}
}
HybridAuthライブラリは、私はエラーを取得しています、
しかしappフォルダの下のwebrootフォルダにあります場合にある6すなわち
ケース6:$エラー=「。ユーザープロファイルの要求はほとんどのユーザーは、プロバイダに接続されていないと、彼は再び認証するようにすべきでありませんでした」。
正確なエラーメッセージが6
は、誰もが何が起こっているのかをお勧め可能な場合を指すUndefined variable: adapter [APP\Controller\UsersController.php, line 177]
です。私はこれをデバッグすることができません。
P.S.これは、Googleのログインでのみ発生
よろしく、 ガンズ
私はこれがかなり古いことを知っていますが、私はこれも持っていて、どのように作成したのか分かりません。 https://security.google.com/settings/security/permissions?pli=1にアクセスしてGoogleからウェブアプリを取り消してログインし直さなければならなかったのですが、本当に原因を知りたいのですが – ST0N3