What is Auth middleware?

Auth middleware will be nothing more than a piece of code that will validate an authentication token and will try to resolve the user against that authentication token. It will be just a piece of code that will be attached to some endpoints in the routes or place from where the data for the endpoint is being returned. In any case, it will execute before the actual code for the endpoint and will validate and resolve the user from the auth token in Request.

In Chapter 6, Illuminating RESTful Web Services with Lumen, we will look into middleware and in Chapter 7, Improving RESTful Web Services, we will write code for authentication middleware.

Get Building RESTful Web Services with PHP 7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.