Skip to content

Commit

Permalink
Explicitly set Content-Type header for Gitea access token (#271).
Browse files Browse the repository at this point in the history
  • Loading branch information
jimafisk committed Nov 8, 2024
1 parent 3be7302 commit fff52f8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions defaults/core/cms/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ const requestAccessToken = async code => {
+ "&grant_type=authorization_code"
+ "&redirect_uri=" + encodeURIComponent(redirectUrl)
+ "&code_verifier=" + encodeURIComponent(codeVerifier),
{ method: 'POST' }
{
method: 'POST',
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
}
);
const tokens = await response.json();
if (tokens.error) {
Expand All @@ -161,7 +166,12 @@ const requestRefreshToken = async () => {
+ "&grant_type=refresh_token"
+ "&redirect_uri=" + encodeURIComponent(redirectUrl)
+ "&code_verifier=" + encodeURIComponent(codeVerifier),
{ method: 'POST' }
{
method: 'POST',
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
}
);
const refreshedTokens = await response.json();
if (refreshedTokens.error) {
Expand Down

0 comments on commit fff52f8

Please sign in to comment.