Authentication

The starting point of every project is the authentication system, in which it is possible to identify the users or customers who will use our application or API. There are many libraries to implement the different ways to authenticate users; in this book, we will see two of the most important ways: OAuth 2 and JWT.

As we already know, microservices are stateless, which means that they should communicate with each other and users using an access token instead of cookies and sessions. So, let's look at what the workflow of the authentication is like using it:

Authentication

Authentication by token workflow

As you can see in the preceding image, this ...

Get PHP Microservices now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.