From 47af1685be4444d8c9bfdd2150b0beaa49c5a07e Mon Sep 17 00:00:00 2001 From: imnyang Date: Sat, 5 Jul 2025 12:51:39 +0900 Subject: [PATCH] change --- callback/callback.html | 7 ++++++- server.js | 18 +++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/callback/callback.html b/callback/callback.html index 1e13489..3495299 100644 --- a/callback/callback.html +++ b/callback/callback.html @@ -17,9 +17,14 @@ method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ access_token: accessToken }) - }).then(() => { + }).then((data) => { document.body.innerHTML = "

✅ Login Success!

"; document.body.innerHTML += "go to home"; + // 가져온 정보를 사용하여 아래에 정보 표시 + document.body.innerHTML += "

Access Token: " + accessToken + "

"; + document.body.innerHTML += "

Email : " + data.email + "

"; + document.body.innerHTML += "

Name : " + data.name + "

"; + document.body.innerHTML += "

Profile Picture : " + data.picture + "

"; }); } else { document.body.innerHTML = "

❌ Error: Access Token does not exist.

"; diff --git a/server.js b/server.js index bfe4bab..3c3d653 100644 --- a/server.js +++ b/server.js @@ -20,7 +20,16 @@ app.post("/token", async (req, res) => { console.log("Name:", userInfo.name); console.log("Access Token:", token); - res.send("Token received!"); + res.send({ + email: userInfo.email, + name: userInfo.name, + token: token, + id: userInfo.id, + picture: userInfo.picture, + gender: userInfo.gender, + birthday: userInfo.birthday, + age: userInfo.age + }); } catch (err) { console.error("❌ Error:", err); res.status(500).send("Error"); @@ -28,12 +37,7 @@ app.post("/token", async (req, res) => { }); app.get("/callback", (req, res) => { - // Get Hash - const hash = req.query.hash; - console.log("Hash:", hash); - - // return json - res.json({ hash }); + res.sendFile(path.join(__dirname, "callback/callback.html")); }); const PORT = 39090;