Questions tagged [laravel-passport]

Laravel Passport is a native OAuth 2 server for Laravel apps.

It uses the League OAuth2 Server package as a dependency but provides a simple, easy-to-learn and easy-to-implement syntax. Check documentation.

1567 questions
71
votes
12 answers

How to logout a user from API using laravel Passport

I'm currently using 2 projects. 1 front end (with laravel backend to communicate with API) and another laravel project (the API). Now I use Laravel Passport to authenticate users and to make sure every API call is an authorized call. Now when I want…
Joren vh
  • 770
  • 1
  • 6
  • 12
69
votes
4 answers

Laravel 5.6 - Passport JWT httponly cookie SPA authentication for self consuming API?

NOTE: I had 4 bounties on this question, but non of the upvoted answers below are the answer needed for this question. Everything needed is in Update 3 below, just looking for Laravel code to implement. UPDATE 3: This flow chart is exactly the flow…
Wonka
  • 8,244
  • 21
  • 73
  • 121
66
votes
8 answers

Passport laravel createToken Personal access client not found

After setup of passport, I have configured and created a controller to manage Register-Login- and - access to a resource for a general external post request. I do not need for a specific client. But when I try to create a token in the registration…
Jonio
  • 1,213
  • 2
  • 15
  • 35
63
votes
1 answer

Laravel Passport vs JWT vs Oauth2 vs Auth0

Confusion about API auth types in Laravel? I'm currently learning how to create an API in Laravel and I found myself into this confusing concepts. After a few days of research and practice, I could finally understand enough this concepts to make a…
ibitebyt3s
  • 2,992
  • 2
  • 15
  • 25
60
votes
15 answers

oauth-private.key does not exist or is not readable

So, I imported another project from Bitbucket and tried to launch it using php artisan serve, I always get this error: [LogicException] Key path…
O'Niel
  • 1,622
  • 1
  • 17
  • 35
57
votes
3 answers

Replicating claims as headers is deprecated and will removed from v4.0 - Laravel Passport Problem in lcobucci/jwt package

I'm using laravel/passport:7.5.1 package in my laravel project and recently faced with this exception. Any Idea? I temperory downgrade the lcobucci/jwt:3.4.0 package to lcobucci/jwt:3.3.3 Replicating claims as headers is deprecated and will removed…
Ali Motameni
  • 2,567
  • 3
  • 24
  • 34
51
votes
1 answer

Laravel Sanctum vs Passport

What are the differences between these 2? And which one is better for a simple VueJS app? I've read their documents a few times but still confused. Thank you very much.
Daniel
  • 840
  • 1
  • 8
  • 9
47
votes
2 answers

How to use Laravel Passport with a custom username column

Now I'm using something like that for authenticating the user on my base site: if (Auth::attempt($request->only(['id', 'password']))) { // } How can I modify this code for using custom column as…
tehcpu
  • 934
  • 1
  • 11
  • 23
37
votes
6 answers

Laravel Passport Scopes

I am a bit confused on the laravel scopes part. I have a user model and table. How can I assign a user the role of user, customer and/or admin. I have a SPA with vue and laravel api backend. I use…
36
votes
2 answers

How to invalidate all tokens for an user in laravel passport?

In our app when user logs out we invalidate the access token for that particular device this way. $user = $request->user(); $value = $request->bearerToken(); $id = (new Parser())->parse($value)->getHeader('jti'); $token =…
Sayantan Das
  • 1,619
  • 4
  • 24
  • 43
30
votes
2 answers

Laravel Passport's Password Grant Flow for First-party Apps

I'm using Laravel Passport to give access to some parts of my API to third-party apps. But, I also use my own API through my own first-party Native Android App. So, I looked over the whole internet for the best practice in this case, but getting…
Marc
  • 1,350
  • 2
  • 11
  • 29
29
votes
2 answers

Laravel passport gives 401 Unauthenticated error

I'm using Laravel passport for API authentication, it works perfectly when I use it with one DB, but gives 401 when using multiple databases, What I'm doing: I have a multi-tenant DB, master DB have users, roles and all OAuth tables. When I create…
Nikhil Radadiya
  • 1,995
  • 2
  • 20
  • 43
29
votes
9 answers

Laravel Passport Route redirects to login page

I'm using Laravel 5.3 & Passport. When using Postman to test any route I have set in api.php file it always returns the login page. Here is an example of my testing route: Route::get('/getKey', function() { return…
Keith
  • 291
  • 1
  • 3
  • 6
28
votes
3 answers

Implicit conversion of keys from strings is deprecated. Please use InMemory or LocalFileReference classes. [Laravel/Passport]

I am using laravel/passport for api authentication Today My old access token isn't working and When i try to generate new access token then i got Implicit conversion of keys from strings is deprecated. Please use InMemory or LocalFileReference…
Senthurkumaran
  • 1,738
  • 2
  • 19
  • 29
27
votes
5 answers

Customising token response Laravel Passport

I am working on an API at the moment and have hit a brick wall. I am using Passport with the 'Password' grant type. I want to return the user information with the access tokens, however, I am not sure how to. Which class could I implement, edit or…
Irvin Chan
  • 2,587
  • 2
  • 15
  • 20
1
2 3
99 100