This method will first authenticate the user by calling [[IdentityInterface::findIdentityByAccessToken()]]
with the provided access token. If successful, it will call User::login to log in the authenticated user.
If authentication fails or User::login is unsuccessful, it will return null.
public loginByAccessToken ( string $token, mixed $type = null ) : yii\web\IdentityInterface | null | ||
$token | string | the access token |
$type | mixed | the type of the token. The value of this parameter depends on the implementation. For example, [[\yii\filters\auth\HttpBearerAuth]] will set this parameter to be `yii\filters\auth\HttpBearerAuth`. |
return | yii\web\IdentityInterface | null | the identity associated with the given access token. Null is returned if the access token is invalid or [[login()]] is unsuccessful. |