change
This commit is contained in:
parent
4cb6f8d3d5
commit
47af1685be
2 changed files with 17 additions and 8 deletions
|
|
@ -17,9 +17,14 @@
|
|||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ access_token: accessToken })
|
||||
}).then(() => {
|
||||
}).then((data) => {
|
||||
document.body.innerHTML = "<h2>✅ Login Success!</h2>";
|
||||
document.body.innerHTML += "<a href='/'>go to home</a>";
|
||||
// 가져온 정보를 사용하여 아래에 정보 표시
|
||||
document.body.innerHTML += "<h3>Access Token: " + accessToken + "</h3>";
|
||||
document.body.innerHTML += "<h3>Email : " + data.email + "</h3>";
|
||||
document.body.innerHTML += "<h3>Name : " + data.name + "</h3>";
|
||||
document.body.innerHTML += "<h3>Profile Picture : " + data.picture + "</h3>";
|
||||
});
|
||||
} else {
|
||||
document.body.innerHTML = "<h2>❌ Error: Access Token does not exist.</h2>";
|
||||
|
|
|
|||
18
server.js
18
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue