As the title clarifies why is the auth key introduced in Yii2? What\'re it\'s main usages and how it is useful in authentication?
As explained previously, you only need to implement getAuthKey() and validateAuthKey() if your application uses cookie-based login feature. In this case, you may use the following code to generate an auth key for each user and store it in the user table:
More details can be found in official documentation: https://www.yiiframework.com/doc/guide/2.0/en/security-authentication