Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zeeshan Ahmad:
JWT authentication for Lumen 5.6
Apr 18, 2018 @ 17:57:25

On his Medium.com blog Zeeshan Ahmad has posted a tutorial showing you how to set up JWT authentication in a Lumen application. Lumen is a micro-framework based on the larger Laravel framework's components.

Recently I have been tinkering with Vue.js to get a taste of it and I decided to create a quick project to get my hands dirty. I decided to create a blog with authentication etc. My main focus was on the frontend so I decided to quickly bootstrap an application in Lumen because of its simplicity and almost zero-configuration development. For the authentication, I decided to go with JWT and this post is going to be a quick write-up on how I integrated that and how anyone can integrate JWT authentication in their APIs.

He then walks you through the process of creating the application, creating the required configuration files/settings and the creation of the model and migration for the users table in the database. After populating the table with some fake seed data, he uses Composer to pull in the firebase/php-jwt library. From there he includes the code for the User controller and the JWT middleware that will handle the decoding of the token and locating the matching user. In his example it doesn't show the authentication process for the creation of the token, just the validation once it's set.

tagged: lumen jwt authentication tutorial firebase

Link: https://medium.com/tech-tajawal/jwt-authentication-for-lumen-5-6-2376fd38d454

Zeeshan Ahmed:
JWT authentication for Lumen 5.4
Sep 06, 2017 @ 17:44:23

In a recent post to his site ** shows you how to create a system that uses a handy package to create JWT authentication handling for a Lumen-based application. Lumen is the microframework sibling to the Laravel framework.

Recently I have been tinkering with Angular-4 to get a taste of it and I decided to create a quick project to get my hands dirty. I decided to create a blog with authentication etc. My main focus was on the frontend so I decided to quickly bootstrap an application in Lumen because of its simplicity and almost zero-configuration development. For the authentication, I decided to go with JWT and this post is going to be a quick write-up on how I integrated that and how anyone can integrate JWT authentication in their APIs.

He then walks you through the setup of a new Lumen project and populates the database with some sample (faked) user information from a seeder. Next he helps you get the firebase/php-jwt library installed via Composer and creates the matching controller and middleware to wire it into the application. In his example the user is authenticated via the standard username/password form and, when successful, generates a JWT token that's then passed along with other requests for validation by the middleware.

tagged: lumen laravel tutorial jwt authentication token firebase package

Link: https://zeeshanu.github.io/2017/09/05/jwt-authentication-for-Lumen-5.4/


Trending Topics: