# Slim 4 Tutorial

**URL:** <https://discourse.slimframework.com/t/slim-4-tutorial/3624>\
**Category:** Show and Tell\
**Created:** [November 7, 2019, 3:06pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624 "2019-11-07T15:06:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [November 7, 2019, 3:06pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/1 "2019-11-07T15:06:46Z")

</div>

> **[Slim 4 Tutorial](https://odan.github.io/2019/11/05/slim4-tutorial.html)**
>
> This tutorial shows you how to work with the powerful and lightweight Slim 4 framework.

---

<div class="post-metadata">

**Author:** ![ediv](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ediv/32/996_2.png) [@ediv](https://discourse.slimframework.com/u/ediv)\
**Post date:** [November 7, 2019, 5:37pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/2 "2019-11-07T17:37:02Z")

</div>

Thanks @odan, this looks like it will be very useful for those of us just transitioning to Slim!

---

<div class="post-metadata">

**Author:** ![stefanvz](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@stefanvz](https://discourse.slimframework.com/u/stefanvz)\
**Post date:** [December 2, 2019, 9:44am UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/3 "2019-12-02T09:44:16Z")

</div>

thanks daniel for this, helped me a lot in understanding whats going on behind the scenes.

is there a way to convince you to add a use case with jwt authentication to this tutorial?

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [December 2, 2019, 11:07am UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/4 "2019-12-02T11:07:03Z")

</div>

Hi @stefanvz Thank you 🙂

That’s a good idea. I think I write a new blog post about [OAuth 2.0](https://oauth.net/2/) in combination with JWT.

---

<div class="post-metadata">

**Author:** ![ediv](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/ediv/32/996_2.png) [@ediv](https://discourse.slimframework.com/u/ediv)\
**Post date:** [December 2, 2019, 4:36pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/5 "2019-12-02T16:36:13Z")

</div>

Nice looking forward to it.

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [December 6, 2019, 7:13pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/6 "2019-12-06T19:13:50Z")

</div>

I wrote a tutorial on how to create and validate JWT with public/private keys using [lcobucci/jwt](https://github.com/lcobucci/jwt). The tutorial also shows how to convert the token into an OAuh 2.0 Access Token Response. You can also reuse or implement your custom user authentication. You can protect single routes and/or route groups via JwtMiddleware. Read more:

[https://odan.github.io/2019/12/02/slim4-oauth2-jwt.html](https://odan.github.io/2019/12/02/slim4-oauth2-jwt.html)

You may also try [tuupola/slim-jwt-auth](https://github.com/tuupola/slim-jwt-auth) instead.

---

<div class="post-metadata">

**Author:** ![stefanvz](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@stefanvz](https://discourse.slimframework.com/u/stefanvz)\
**Post date:** [December 12, 2019, 7:09pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/7 "2019-12-12T19:09:09Z")

</div>

thanks Daniel. good addition to your tutorial and helped me to make my solution more robust.

---

<div class="post-metadata">

**Author:** ![wilmarzop](https://avatars.discourse-cdn.com/v4/letter/w/9fc348/32.png) [@wilmarzop](https://discourse.slimframework.com/u/wilmarzop)\
**Post date:** [February 7, 2022, 3:56pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/8 "2022-02-07T15:56:23Z")

</div>

is there a way to convince you to add a use case with jwt authentication to this tutorial?[.](https://techzpod.com/) [.](https://get-mobdrovip.com)

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [February 7, 2022, 7:07pm UTC](https://discourse.slimframework.com/t/slim-4-tutorial/3624/9 "2022-02-07T19:07:06Z")

</div>

This depends on your use case. In most cases, the authentication is getting done via [HTTP Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication) to get a JWT. The [tuupola/slim-basic-auth](https://github.com/tuupola/slim-basic-auth) component works very good in combination with Slim. I think I will write a blog post about this topic in the next days.
