YII2 uses restful mode, no cookie, where does Authkey get it? In restful mode, every visit comes with Access_token, but there is no authkey, is there any need for Authkey?
Reply content:
YII2 uses restful mode, no cookie, where does Authkey get it? In restful mode, every visit comes with Access_token, but there is no authkey, is there any need for Authkey?
The implementation according to yii-app-advanced:
-
User.auth_key only one, used to log in from a cookie
-
The user table does not have a access_token field
In practice, a user will have more than one access_token, so another table is needed to store it;
This is two things, don't mix it up.
Specifically in the framework of YII and rest interface How to do authentication, can refer to:
-
Yii\rest\controller::behaviors () [Authenticator]
-
Yii\filters\auth\compositeauth
-
Yii\filters\auth\queryparamauth