1

I need clear information about laravel API.

I've been reading lots of articles about laravel API. Beside choosing between JWT and laravel-passport—which is a whole different level of confusion—I need to get basic information about laravel API to make it clearer to me what's what.

Questions

  1. Why does laravel passport need a database (what's the usage of those tables)?
  2. If I change auth driver to passport in authProvider file, and not use api, would it affect my normal auth behavior?
  3. If i use API (passport) do I have to use laravel-echo or any js library?
szaman
  • 2,159
  • 1
  • 14
  • 30
mafortis
  • 6,750
  • 23
  • 130
  • 288

1 Answers1

1

Laravel passport needs database to store tokens that are generated and used during authorization. Also, needs to bind these tokens to a specific users.

There are actually 5 new tables that are generated from migrations when installing Laravel Passport:

https://github.com/laravel/passport/tree/7.0/database/migrations

About using Laravel Echo or any js library is optional, and Laravel Passport does not require any of these.

See the Laravel Passport composer.json on requirements and other dependencies:

https://github.com/laravel/passport/blob/7.0/composer.json

Nikola Kirincic
  • 3,651
  • 1
  • 24
  • 28
  • 1
    And just a small add laravel JWT(Tymon) holds user data to verify and is part of the Authorization header. But the token is generated and passed as a header + has expiration time but is not stored anywhere (unless you want to but there is no reason) – pr1nc3 Mar 26 '19 at 08:20