2022-04-25 14:09:37 +02:00
|
|
|
const { getToken, getMe } = require("../../../lib/oauth/mw.js");
|
|
|
|
const lib = require("lib")({ token: process.env.STDLIB_SECRET_TOKEN });
|
2022-04-21 08:49:16 +02:00
|
|
|
|
|
|
|
module.exports = async (state, code) => {
|
|
|
|
if (state) {
|
|
|
|
if (state == "abc123") {
|
2022-04-25 14:09:37 +02:00
|
|
|
return getToken(code, state);
|
2022-04-21 08:49:16 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return {
|
2022-04-25 14:09:37 +02:00
|
|
|
headers: {
|
|
|
|
Location:
|
|
|
|
"https://recaptime.miraheze.org/wiki/Portal:NoStateCodeDetected",
|
|
|
|
},
|
2022-04-21 08:49:16 +02:00
|
|
|
statusCode: 302,
|
2022-04-25 14:09:37 +02:00
|
|
|
body: Buffer.from(""),
|
|
|
|
};
|
2022-04-21 08:49:16 +02:00
|
|
|
}
|
2022-04-25 14:09:37 +02:00
|
|
|
};
|