[backend] Cleanup oauth debug logging

This commit is contained in:
Laura Hausmann 2023-10-05 14:38:14 +02:00
parent 0611651409
commit 37b5a8d71d
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -136,6 +136,7 @@ router.get("/identicon/:x", async (ctx) => {
}
});
//TODO: move these to auth.ts
mastoRouter.get("/oauth/authorize", async (ctx) => {
const { client_id, state, redirect_uri } = ctx.request.query;
console.log(ctx.request.req);
@ -163,13 +164,6 @@ mastoRouter.post("/oauth/token", async (ctx) => {
}
let token = null;
if (body.code) {
//m = body.code.match(/^([a-zA-Z0-9]{8})([a-zA-Z0-9]{4})([a-zA-Z0-9]{4})([a-zA-Z0-9]{4})([a-zA-Z0-9]{12})/);
//if (!m.length) {
// ctx.body = { error: "Invalid code" };
// return;
//}
//token = `${m[1]}-${m[2]}-${m[3]}-${m[4]}-${m[5]}`
console.log(body.code, token);
token = body.code;
}
try {
@ -180,7 +174,6 @@ mastoRouter.post("/oauth/token", async (ctx) => {
scope: body.scope || "read write follow push",
created_at: Math.floor(new Date().getTime() / 1000),
};
console.log("token-response", ret);
ctx.body = ret;
} catch (err: any) {
console.error(err);