Skip to content

Commit

Permalink
Merge pull request #13153 from brunoeduardodev/release-3.0
Browse files Browse the repository at this point in the history
fix: oauth_.fetch invocation on github_server and google_server
  • Loading branch information
denihs committed May 23, 2024
2 parents 5bce0eb + 2c2dd3a commit bae5597
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 3 additions & 5 deletions packages/github-oauth/github_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const getAccessToken = async (query) => {
});
const request = await OAuth._fetch(
`https://github.com/login/oauth/access_token?${content.toString()}`,
'POST',
{
method: 'POST',
headers: {
Accept: 'application/json',
'User-Agent': userAgent
Expand Down Expand Up @@ -76,8 +76,7 @@ const getAccessToken = async (query) => {

const getIdentity = async (accessToken) => {
try {
const request = await OAuth._fetch('https://api.github.com/user', {
method: 'GET',
const request = await OAuth._fetch('https://api.github.com/user', 'GET', {
headers: {
Accept: 'application/json',
'User-Agent': userAgent,
Expand All @@ -95,8 +94,7 @@ const getIdentity = async (accessToken) => {

const getEmails = async (accessToken) => {
try {
const request = await OAuth._fetch('https://api.github.com/user/emails', {
method: 'GET',
const request = await OAuth._fetch('https://api.github.com/user/emails', 'GET', {
headers: {
'User-Agent': userAgent,
Accept: 'application/json',
Expand Down
7 changes: 3 additions & 4 deletions packages/google-oauth/google_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ const getTokens = async (query, callback) => {
redirect_uri: OAuth._redirectUri('google', config),
grant_type: 'authorization_code',
});
const request = await OAuth._fetch('https://accounts.google.com/o/oauth2/token', {
method: 'POST',
const request = await OAuth._fetch('https://accounts.google.com/o/oauth2/token', 'POST', {
headers: {
Accept: 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
Expand Down Expand Up @@ -176,8 +175,8 @@ const getIdentity = async (accessToken, callback) => {
try {
const request = await OAuth._fetch(
`https://www.googleapis.com/oauth2/v1/userinfo?${content.toString()}`,
'GET',
{
method: 'GET',
headers: { Accept: 'application/json' },
}
);
Expand All @@ -196,8 +195,8 @@ const getScopes = async (accessToken, callback) => {
try {
const request = await OAuth._fetch(
`https://www.googleapis.com/oauth2/v1/tokeninfo?${content.toString()}`,
'GET',
{
method: 'GET',
headers: { Accept: 'application/json' },
}
);
Expand Down

0 comments on commit bae5597

Please sign in to comment.