This commit is contained in:
암냥 2025-07-05 12:54:19 +09:00
commit fdc903a3c1
2 changed files with 4 additions and 26 deletions

View file

@ -7,8 +7,8 @@ app.use(express.static("public")); // public 폴더 내 정적 파일 제공
app.use(express.json()); // JSON 본문 파싱
// Access Token 수신용 엔드포인트
app.post("/token", async (req, res) => {
const token = req.body.access_token;
app.get("/token", async (req, res) => {
const token = req.query.access_token;
try {
const response = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
headers: {
@ -23,12 +23,7 @@ app.post("/token", async (req, res) => {
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
token: token
});
} catch (err) {
console.error("❌ Error:", err);