Skip to content

Commit

Permalink
its wokring i thinkw
Browse files Browse the repository at this point in the history
  • Loading branch information
Ianyourgod committed Mar 29, 2024
1 parent 3b136df commit e3eb399
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions api/v1/routes/users/OAuthlogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ module.exports = (app, utils) => {
// now make the request
const response = await utils.UserManager.makeOAuth2Request(code, "scratch");

console.log(response.access_token);

const username = await fetch("https://oauth2.scratch-wiki.info/w/rest.php/soa2/v0/user", {
headers: {
Authorization: `Bearer ${btoa(response.access_token)}`
}
}).then(res => res.status);
})
.then(async res => {
return {"user": await res.json(), "status": res.status};
});

console.log(username);
if (username.status !== 200) {
utils.error(res, 500, "InternalError");
return;
}

res.status(200);
res.send("hi");
res.send(JSON.stringify(username));
});
}

0 comments on commit e3eb399

Please sign in to comment.