Skip to content

Commit

Permalink
Fix Deprecating API authentication through query parameters
Browse files Browse the repository at this point in the history
As soon as the pull request was created, the problem was fixed by @sunnysidesounds

fixed #489
  • Loading branch information
EdZava authored and hackjutsu committed May 31, 2021
1 parent ec748d9 commit cf4abcb
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions app/utilities/githubApi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ function getSingleGist (token, gistId) {
uri: SINGLE_GIST_URI + gistId,
agent: proxyAgent,
headers: {
'User-Agent': userAgent
'User-Agent': userAgent,
Authorization: 'token ' + token
},
method: 'GET',
qs: {
access_token: token
},
json: true, // Automatically parses the JSON string in the response
timeout: 2 * kTimeoutUnit
})
Expand Down Expand Up @@ -185,10 +183,10 @@ function makeOptionForGetAllGists (token, userId, page) {
agent: proxyAgent,
headers: {
'User-Agent': userAgent,
Authorization: 'token ' + token
},
method: 'GET',
qs: {
access_token: token,
per_page: GISTS_PER_PAGE,
page: page
},
Expand All @@ -203,13 +201,11 @@ function createSingleGist (token, description, files, isPublic) {
return ReqPromise({
headers: {
'User-Agent': userAgent,
Authorization: 'token ' + token
},
method: 'POST',
uri: `https://${gitHubHostApi}/gists`,
agent: proxyAgent,
qs: {
access_token: token
},
body: {
description: description,
public: isPublic,
Expand All @@ -225,13 +221,11 @@ function editSingleGist (token, gistId, updatedDescription, updatedFiles) {
return ReqPromise({
headers: {
'User-Agent': userAgent,
Authorization: 'token ' + token
},
method: 'PATCH',
uri: `https://${gitHubHostApi}/gists/${gistId}`,
agent: proxyAgent,
qs: {
access_token: token
},
body: {
description: updatedDescription,
files: updatedFiles
Expand All @@ -246,13 +240,11 @@ function deleteSingleGist (token, gistId) {
return ReqPromise({
headers: {
'User-Agent': userAgent,
Authorization: 'token ' + token
},
method: 'DELETE',
uri: `https://${gitHubHostApi}/gists/${gistId}`,
agent: proxyAgent,
qs: {
access_token: token
},
json: true,
timeout: 2 * kTimeoutUnit
})
Expand Down

0 comments on commit cf4abcb

Please sign in to comment.