I tried to GET event data through a third party API, which is HubDB. It requires a bearer token. How could I add bearer token to the api call. Which position of the below code I can add the bearer token?
React.useEffect(() => {
getJson(‘url’, (events) => {
setEvents(events);
}, ‘jsonp’);
}, []);
Trying to GET event data through a third party API
Hello @Charles_Zhang
The built in getJson function, you are trying to use, cannot be used to pass any other http headers. You can however create your own http request using the XMLHttpRequest described on W3Schools or other blogs as well.