abdel.ouam
abdel.ouam

Reputation: 81

Use Laravel Passport with Angular 6

I have a Laravel application in which I'm using Passport for authentication. I have multiple questions about the Passport authentication:

Thanks

Upvotes: 0

Views: 678

Answers (1)

Flame
Flame

Reputation: 7618

Tokens can be removed by using one of the artisan commands that come with it:

php artisan passport:purge --expired

So you could call this artisan command using the scheduler, say once a day.

See https://laravel.com/docs/7.x/passport#purging-tokens for additional info.

As for your second question, well there are various ways to do that. One way is explained here https://laravel.com/docs/7.x/passport#consuming-your-api-with-javascript , which explains how you can add a middleware which attaches a laravel_token cookie to each request. This cookie is then automatically sent from your JavaScript requests, and will authenticate the user.

Upvotes: 1

Related Questions