---
title: "Comment by Osinachi Chukwujama  on \"Create A custom Http Service Provider in React\" | Hashnode"
description: "Quite a neat method. Axios has a way of setting the authorization token once, globally. By using axios.defaults.headers.common[ &#x27;Content-Type&#x27; ] = &#x"
url: "https://hashnode.com/posts/create-a-custom-http-service-provider-in-react/5fd3280dcd0355570faea63a/comment/5fd33d27cd0355570faea731"
---

[Discussion](https://hashnode.com/posts/create-a-custom-http-service-provider-in-react/5fd3280dcd0355570faea63a)

Comment [Create A custom Http Service Provider in React](https://hashnode.com/posts/create-a-custom-http-service-provider-in-react/5fd3280dcd0355570faea63a)

[Osinachi Chukwujama](https://hashnode.com/@Vicradon)

[Dec 11, 2020](https://hashnode.com/posts/create-a-custom-http-service-provider-in-react/5fd3280dcd0355570faea63a/comment/5fd33d27cd0355570faea731)

Quite a neat method. Axios has a way of setting the authorization token once, globally. By using

```
axios.defaults.headers.common['Content-Type'] = 'application/json';
axios.defaults.headers.common['Authorization'] = `Bearer ${access_token}`;
```

Check this [StackOverflow answer](https://stackoverflow.com/a/52115487/10939384) for more info.

[Johnson awah Alfred](https://hashnode.com/@codemon)

[Dec 11, 2020](https://hashnode.com/posts/create-a-custom-http-service-provider-in-react/5fd3280dcd0355570faea63a/comment/5fd33d27cd0355570faea731#reply-5fd34e4402d534634d37f84c)

Yeah.. this works just fine as a clean alternative to the object thing I did above.
