Login With API instead of database

Hello to all, please read this carefully to understand my problem, thank you.

Okey I need to login the user matching the credentials with an external api, this api only return true if the user:pass are correct otherwise return false, okey now with this flag i need to create something like the array in the User model like




'100' => [

            'id' => '100',

            'username' => 'admin',

            'password' => 'admin',

            'authKey' => 'test100key',

        ],



obviusly the id, and authKey had to be create dinamically.

and pass it throut the login method, but idk how to do this, please im newbie in yii2

Hi,

First of all I would suggest you read the whole guide:

Guide: http://www.yiiframework.com/doc-2.0/guide-index.html

Then I suggest you learn how you do authentication with database instead of hardcoded users inside your model:

  1. Concepts: http://www.yiiframework.com/doc-2.0/guide-security-authentication.html

  2. Tutorial: http://www.bsourcecode.com/yiiframework2/yii-2-user-login-from-database/

After you have read & understood the above, you could just search on google…

"yii2 authentication myExternalApiName"

For Example:

"yii2 authentication google"

Best Regards