odan / slim4-skeleton

A Slim 4 Skeleton
https://odan.github.io/slim4-skeleton/
MIT License
439 stars 80 forks source link

Any auth in your sceleton? #96

Closed palansher closed 2 years ago

palansher commented 2 years ago

Hello!

Thank you for your articles!

I saw many old references that you used session authentication in Slim skeleton. Now, in this repo I see no traces of ANY authentication in middleware or in somewhere else. Did you remove that?

My goal is to learn how to use session auth using a middleware in Slim apps. Maybe your e-book have some practical examples for that?

odan commented 2 years ago

Hi @palansher

Sessions has been removed from the Skeleton project, to make it more agnostic and API friendly. Sessions are mostly used for web-applications with a frontend. There is maybe one exception, for example when you implement a OAuth 2 Implicit Grant flow. But the implicit grant flow is no longer a suitable authentication method anyway.

There are plenty of options for auth available. The "best" solution depends on your project specific requirements, e.g. Sessions (Cookie authentication), Basic Auth, API-Keys, Bearer (JWT), Oauth2 (authorization) etc.

In my eBooks (vol1 and vol2) you will find articles and examples covering all these topics.

palansher commented 2 years ago

Thanks! Got it.