Skip to content

Commit

Permalink
use header instead of url param for Battle.net access token
Browse files Browse the repository at this point in the history
  • Loading branch information
emallson committed Oct 29, 2024
1 parent 7d17b91 commit 41c64ca
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/route/blizzard/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,16 @@ async function fetchApi<T>(
return undefined;
}
const accessToken = await fetchAccessToken(region);
const url = makeUrl(region, path, {
access_token: accessToken,
...query,
});
const url = makeUrl(region, path, query);

try {
return (await axios.get(url))?.data;
return (
await axios.get(url, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
)?.data;
} catch (err: unknown) {
if (
err instanceof AxiosError &&
Expand Down

0 comments on commit 41c64ca

Please sign in to comment.