Reputation: 442
I just installed Passport and added Passport::routes()
to my serviceprovider. It gave me these routes /oauth/token POST
, /oauth/tokens GET
, /oauth/token/{Token_id} DELETE
.
I am using Password Grant Tokens for authentication(https://laravel.com/docs/5.6/passport#password-grant-tokens)
I ran the POST request to make a new token and it created the token just fine. But when I try to run the GET to see all the token, it returns an empty array. I have around 10 tokens already generated in my DB.
Shouldn't I be getting a list of all the oauth tokens that's stored in the database?
If not, Is there a way to index all the tokens for admin use?
Upvotes: 0
Views: 2020
Reputation: 1989
The GET /oauth/tokens
route returns all tokens for the currently authenticated user only, not all users.
To get all tokens, with their associated users, you can use the following.
\Laravel\Passport\Token::with('user')->get()
Upvotes: 1