tuupola / slim-jwt-auth

PSR-7 and PSR-15 JWT Authentication Middleware
https://appelsiini.net/projects/slim-jwt-auth
MIT License
829 stars 142 forks source link

How to use it with web application #100

Closed dpbuzz closed 6 years ago

dpbuzz commented 6 years ago

Hi Mika, first of all thanks for developing the middleware and supporting us!. I added to my web application a slim api for providing some basic mobile services. But now I need to add a new module, and I planning to use the slim api to do the update in database, etc... The web application use session variables that i will use in the new endpoints. How is the way to integrate in the same api the need for the jwt-auth for mobile access, and session variables handling for the web app acces? Thanks

tuupola commented 6 years ago

Having two different kind of authentications for one route is not a good idea. Better would be to separate the public website and api. For example put the api into /api/ folder and use JWT only there.

dpbuzz commented 6 years ago

So you say to have two entry points?

/mobile/api for mobile access using jwt /web/api for web application using session

In this way I can share all routes because the only difference is the autentication method.

tuupola commented 6 years ago

Sorry but I do not really understand what you are trying to do. You could check on of the example applications for inspiration.

https://github.com/tuupola/slim-api-skeleton https://github.com/akrabat/slim-bookshelf https://github.com/akrabat/slim-bookshelf-api

Webprogr commented 2 years ago

Hi, Can you provide if possible a 'https://github.com/tuupola/slim-api-skeleton' with the slim-jwt-auth so we know what is the best way to do it? Thanks

tuupola commented 2 years ago

Even though it has not been updated for a while, the skeleton uses tuupola/slim-jwt-auth.

https://github.com/tuupola/slim-api-skeleton/blob/master/config/middleware.php#L44-L59