Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/wrapper/fetchAccessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const fetchAccessToken = async ({
const encoded = base64Encode(authString);

const res = await fetch(`https://${host}/oauth2-cc/token`, {

method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Expand All @@ -40,6 +41,9 @@ export const fetchAccessToken = async ({
}).toString(),
cache: "no-cache",
});
if (res.ok) {
throw new Error(`Failed to fetch access token: (${res.status} ${res.statusText})\n ${await res.text()}`);
}
return z
.object({
access_token: z.string(),
Expand Down
Loading