fix: update src/routes/_api/oauth.js

This commit is contained in:
Nolan Lawson 2023-01-08 21:43:16 -08:00 committed by GitHub
parent bf32c3b4ab
commit 623e6c50ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -27,6 +27,8 @@ export function generateAuthLink(instanceName, clientId, redirectUri) {
export function getAccessTokenFromAuthCode(instanceName, clientId, clientSecret, code, redirectUri) {
const url = `${basename(instanceName)}/oauth/token`
// Using URLSearchParams here guarantees a content type of application/x-www-form-urlencoded
// See https://fetch.spec.whatwg.org/#bodyinit-unions
return post(url, new URLSearchParams({
client_id: clientId,
client_secret: clientSecret,