B
B
Bags2017-04-17 13:03:59
Yii
Bags, 2017-04-17 13:03:59

How to log in and get a bearer token to make requests in Yii2?

I'm trying to create a REST (or similar) web api site application in Yii2.
I want to make the client send a POST request with a username and password to receive a token. After that, with each request, this same token was sent.
Correctly understood that it is best to configure this extension https://github.com/yiisoft/yii2-authclient/ and then follow the instructions stuff.cebe.cc/yii2docs-en/guide-rest-authenticatio... ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2017-04-17
@slo_nik

Good afternoon.
Here everything is told in detail, to the smallest detail, from the very basics.

M
Mikhail Serenkov, 2017-04-17
@miserenkov

yii2-authclient is needed for authentication through social networks using oauth, and you need an action that, based on the incoming login and password, will generate, save the user in the table an access key and send it to the client, and then follow the guide from the documentation, configure the behavior in the controller and implement in user models, the findByAccessToken method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question