Use JWT to Make a Protected Request

Share this video with your friends

Send Tweet

We are going to use our JWT to make a protected request.

All we have to do is create a button with a click event that calls our fetchRepos function. In the fetchRepos function make a fetch request to the /repos endpoint. In the fetch, pass an Authorization header with your JWT as a Bearer token. Then just await the response!