Rest 这是支持多种身份验证模式的好方法吗?

Rest 这是支持多种身份验证模式的好方法吗?,rest,authentication,cakephp,Rest,Authentication,Cakephp,我目前正在进行cakephp2网站迁移,我们计划开发cakephp3 restful api。该网站目前支持多种身份验证模式(使用用户密码、使用facebook帐户、使用谷歌帐户)。 对于一种身份验证方式(用户密码),我使用cakephp的BasicAuthenticate很容易找到一种restful方式来实现这一点。但是,对于其他身份验证方法,我在AppController中执行了类似的操作: public function beforeFilter(Event $event) {

我目前正在进行cakephp2网站迁移,我们计划开发cakephp3 restful api。该网站目前支持多种身份验证模式(使用用户密码、使用facebook帐户、使用谷歌帐户)。 对于一种身份验证方式(用户密码),我使用cakephp的BasicAuthenticate很容易找到一种restful方式来实现这一点。但是,对于其他身份验证方法,我在AppController中执行了类似的操作:

 public function beforeFilter(Event $event) {
    parent::beforeFilter($event);
    // We try to get the authType and the corresponding token if they are sent as a parameter
    $authType = $this->request->getQuery('type');
    $token = $this->request->getQuery('token');
    if($token !=null) {
        switch ($authType) {
            case 'facebook':
                $this->facebookAuth($token);
                break;
            case 'google':
                $this->googleAuth($token);
                break;
        }
    }
}

我目前正在手动设置用户的身份验证是否成功,我想知道这是否是一种“干净”的方式。

您使用的是什么版本的cakephp 3?正如我在帖子中所说,我再次使用Cakephp3,我问您使用的是什么版本的cakephp 3。如果你用的是3.4哦,我的错,3.4