Logged User
Implement the logic to decode the token and find the corresponding user.
We implemented the following logic: the API returns the authentication token to the client if credentials are correct. We’ll now implement how to find the corresponding user of the authentication token given in the HTTP header. We’ll need to do so each time this client requests an entry point that requires permission.
We will use the HTTP header Authorization
for this purpose. We can also use a GET
parameter named apiKey
but will be using an HTTP header to give context to the request without polluting the URL with additional parameters.
Get hands-on with 1400+ tech skills courses.