Closed bitvilag closed 3 years ago
Hello @bitvilag i have been stuck with the same erro here is the solution : it is simple you should just add the header to your request like that ( key : accept , value : application/json ) you can test your api in postman
This package was designed to projects that works exclusive as API.
It means you should not have views just controllers. So, you should not have a login
route.
If you have a traditional laravel project, with full MVC system this package maybe is not for you. I should check https://github.com/Vizir/laravel-keycloak-web-guard
@Abdelghnii : Thanks for the answer. I have not tested it (as I turned to an expressjs based backend instead) but at first glance it could be the answer to my issue. I will check it out sometime later.
@robsontenorio : I did understand the intention of the project hence I started using your solution, however I was not aware of how the request arrives to laravel from firecamp by default hence my code was looking for a login. I do believe you should update this in the docs as I installed a stock laravel which contained this route login by default (even though I wasn't using it). This means there should be a sentence in your docs like troubleshooting where you state if you face this issue than please make sure json is set in the request. Thats my opinion.
Btw great work thanks.
It is closed but you should set header to Accept application/json when you call the api from you frontend.
I tried out your implementation and I am having some trouble.
Symfony\Component\Routing\Exception\RouteNotFoundException Route [login] not defined. http://localhost:8000/api/protected-endpoint latest laravel
I have made default as requested (for API) and using firecamp for testing. I wonder what I am doing wrong.
What is the expected behaviour to reach a site which is protected and not authenticated? Do you have a sample implementation at hand which I can look at?
I would be using laravel as an API server only and use reactjs as UI, but after a few days research I might move away from laravel (not that openidconnect client friendly by default). You are my last hope:) PHP can natively run on hosting servers hence my choice instead of an expressjs or some other which requires at least a docker/kubernetes/etc
I hope you can answer fast though my project is private so non-commercial.