Yii3 - How to start

Comparing #24 with #25

Revision #25 was created by rackycz rackycz on Oct 10, 2025, 7:17:37 AM.

edit

Content

[...]
Below I am indicating how to implement "Random Token Authentication". Other options would be:
- JWT (JSON Web Token) .. I see some disadvatages
- OAuth, OAuth2 - too complex for a simple API

Before you start, install dependency:
 
- composer require yiisoft/security
 
 
Let's create a migration for storing the access tokens:

```php
// method up():
$b->createTable('user_token', [
'id' => $b->primaryKey(),
[...]