How do I make an API call server side?

Viewed 23

I've created a client-side application that makes an API call. The issue with this, however, is that in order to make the API call, I have to use an API Key. If I make the call client-side, the user will be able to see the API key. How do I avoid this? Well, if the answer is to call the API server-side, how do I do that? There seems to be little information wherever I look regarding server-side programming, and if anyone could lead me in the right way, it would be great.

1 Answers

You have to set it in the header with bearer

    let config = {
             headers: {
                    'Authorization': 'Bearer ' + KEY
             }
    };
    Axios.get('http://url', {}, config )
    .then( (response) => {
         console.log(response)
    })
    .catch();
Related