From the course: Node.js: Microservices

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Using bearer headers

Using bearer headers - Node.js Tutorial

From the course: Node.js: Microservices

Using bearer headers

- [Instructor] In this video, we will change our catalog service so that it requires some authorization for specific actions. And for that, we will use this so-called authorization bearer. So, you see this here in this diagram. So when we post or put to items on the catalog service, I want to add a header that contains my token. And the convention for that is that, this header is called authorization:bearer and then the token. So this is how you transport the JWT token with a request without having to send it in the regular payload or as a request parameter. For that, I will first head back into Visual Studio code and I will open Server, Routes, Admin because this is now an admin route item. So there is everything that deals with CRUD for items. So I open index.js and let's scroll down, where we have this post request that will change an item. And down here somewhere, you see that we have this catalog service…

Contents