please provide some more details of your code and a screen shot of your postman request. it would be more helpful to give an answer.
Commented Apr 7, 2021 at 18:10laravel gives token when you try to authenticate. It's done using post and the data is sent in raw (json/text) format.
Commented Apr 7, 2021 at 18:11 you could better have a look at this. positronx.io/… Commented Apr 7, 2021 at 18:12This person walks you through the process nicely and should get you setup. https://coding-lesson.com/api-authentication-with-laravel-passport/
Basically you need to:
Of course you'll want to then change all this to use variables after you get it right, so you don't have to keep repeating this with all your new API calls.
answered Apr 8, 2021 at 16:49 Rob.Kachmar Rob.Kachmar 2,178 1 1 gold badge 19 19 silver badges 23 23 bronze badgesTo fetch data behind protected routes you need to provide a token that will verify that the user who made the call is authenticated.
Then you have to provide the token in Authorization section of postman.
answered Apr 7, 2021 at 18:15 11 2 2 bronze badgesI assume you know the difference between Post and Get . Laravel works a little different then regular PHP , let me tell you how.
In your case you're accessing localhost:8888/myapp/server/api/v1/admin/role which is a protected route under admin middleware. You'll have to first access token and then send token with the get request to fetch the required data.