Auth flow example

  1. User has not logged in yet (there is no cookie).

Auth1

  1. After making a GET request to /auth/login, if user is not logged in, browser redirects to the OIDC service where the user can log in with credentials or third party providers, such as Google.

Login

  1. After a successful login, token is stored as a “samesite” cookie. Now, all requests made to the backend microservices behind localhost (or the site where is running the auth microservice) send the cookie together with the request.

Auth2

How do microservices check that a request is authenticated?

Each endpoint checks if the access token is present as a cookie or as an authorization header (being prioritized the cookie), checks its validity and decodes it to set the user_data (contained inside the access token, having name, email and profile image, for example) inside request data

Auth deps