Cakephp 如何使用Cakedc用户插件进行登录以及社交帐户
我已经为不同的社交登录安装了用户插件和所有其他5个插件。当我正常登录时,它会给我一个重定向URL错误,当我用Facebook点击登录时,它会把我带到myproject/auth/Facebook。我不知道我要为这个Url创建什么,只是需要一些指导。先谢谢你 应用程序控制器Cakephp 如何使用Cakedc用户插件进行登录以及社交帐户,cakephp,plugins,cakephp-3.0,cakedc,Cakephp,Plugins,Cakephp 3.0,Cakedc,我已经为不同的社交登录安装了用户插件和所有其他5个插件。当我正常登录时,它会给我一个重定向URL错误,当我用Facebook点击登录时,它会把我带到myproject/auth/Facebook。我不知道我要为这个Url创建什么,只是需要一些指导。先谢谢你 应用程序控制器 class AppController extends Controller { public function initialize() { parent::initialize(); /
class AppController extends Controller
{
public function initialize()
{
parent::initialize();
// $this->loadComponent('Security');
$this->loadComponent('Flash');
$this->loadComponent('RequestHandler');
$this->loadComponent('CakeDC/Users.UsersAuth');
}
public function beforeRender(Event $event)
{
if (!array_key_exists('_serialize', $this->viewVars) &&
in_array($this->response->type(), ['application/json', 'application/xml'])
) {
$this->set('_serialize', true);
}
}
}
我在Bootstrap.php中添加了这段代码
Configure::write('Users.Social.login', true); //to enable social login
Configure::write('OAuth.providers.facebook.options.clientId', '8660982830167491');
Configure::write('OAuth.providers.facebook.options.clientSecret', 'secret');
Configure::write('OAuth.providers.google.options.clientId', '7724091450376-birdmh5a3t48b8mg9knq0lonup6aeomk.apps.googleusercontent.com');
Configure::write('OAuth.providers.google.options.clientSecret', 'secret');
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);
Configure::write('OAuth.providers.facebook.options.clientId', '17076687932896982');
Configure::write('OAuth.providers.facebook.options.clientSecret', 'be3ca9743ae0bd278ee61c4bda770907fc');
Configure::write('OAuth.providers.twitter.options.clientId', '1082264240790-8ns1ohig1f3iqlgo9okac3kr3p50j44det.apps.googleusercontent.com');
Configure::write('OAuth.providers.twitter.options.clientSecret', 'odSeNKMK5dWpQpfNu8LbGX_K');
你看过文档了吗?你找到解决这个问题的方法了吗?我面临着类似的问题,我可以做社会登录,但正常登录时会出现错误消息用户名或密码不正确时,社会登录启用,否则它的工作正常。