I am having difficulty understanding the workings of Laravel Passport.
I have set it up as per docs, and I have a route like this in api.php
Route::get('/sales', 'SalesController@index')->middleware('auth:api');
Using all the instructions in the docs I have all the auth middleware etc setup, and when I login to the site in browser, it all works great.
However, whats confusing is that via Postman, in order to test the API, I am getting the unauthenticated
error. As per docs Laravel does some magic and makes it work, however in Postman, I am sending the Bearer
token after get it via the route /oauth/token
, and still getting the unauthenticated error.
So what should the guard on the API route be ? As above, using auth:api
, it seems to work well to make sure user is logged in, however how can I test it in Postman ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire