# It seems the kakaoCallback function isn't executing. The kakaoCallback directory isn't being created and no error messages are being displayed

**URL:** <https://forum.wixstudio.com/t/it-seems-the-kakaocallback-function-isnt-executing-the-kakaocallback-directory-isnt-being-created-and-no-error-messages-are-being-displayed/73676>\
**Category:** Ask the community\
**Tags:** wix-http-functions, wix-data, wix-members-area, code, question\
**Created:** [September 19, 2025, 5:14am UTC](https://forum.wixstudio.com/t/it-seems-the-kakaocallback-function-isnt-executing-the-kakaocallback-directory-isnt-being-created-and-no-error-messages-are-being-displayed/73676 "2025-09-19T05:14:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CLASSICFM](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/classicfm/32/110843_2.png) [@CLASSICFM](https://forum.wixstudio.com/u/CLASSICFM)\
**Post date:** [September 19, 2025, 5:14am UTC](https://forum.wixstudio.com/t/it-seems-the-kakaocallback-function-isnt-executing-the-kakaocallback-directory-isnt-being-created-and-no-error-messages-are-being-displayed/73676/1 "2025-09-19T05:14:08Z")

</div>

This is the code for implementing Kakao social external login.

It seems the `kakaoCallback` function isn’t executing. The `kakaoCallback` directory isn’t being created and no error messages are being displayed.

What could be the reason?

[kakaoCallback.jsw]

**import** { redirect, serverError } **from** ‘wix-http-functions’;

**export**  **async**  **function** get\_kakaoCallback(request) {

**try** {

```
console.log("카카오 콜백 함수 호출됨");

// 로그인 후 이동시킬 페이지 경로

**return** redirect("https://www.ohvely22.net/home"); // 또는 "/home" 등 너의 실제 페이지 경로

```

} **catch** (err) {

```
console.error("카카오 콜백 오류:", err);

**return** serverError({ error: err.message });

```

}

}

[kakao.jsw]

// backend/kakao.jsw

**import** { ok, serverError } **from** ‘wix-http-functions’;

**import** { getSecret } **from** ‘wix-secrets-backend’;

**import** fetch **from** ‘node-fetch’;

**import** wixData **from** ‘wix-data’;

**import** { authentication } **from** ‘wix-members-backend’;

**export**  **async**  **function** get\_kakaoCallback(request) {

**try** {

```
**const** code = request.query\["code"\];

**if** (!code) {

  **throw**  **new** Error("Authorization code is missing.");

}

**const** REST_API_KEY = **await** getSecret("KAKAO_REST_API_KEY");

**const** REDIRECT_URI = **await** getSecret("KAKAO_REDIRECT_URI");

// 1. 액세스 토큰 요청

**const** tokenRes = **await** fetch("https://kauth.kakao.com/oauth/token", {

  method: "POST",

  headers: { "Content-Type": "application/x-www-form-urlencoded" },

  body: \`grant_type=authorization_code&client_id=${REST_API_KEY}&redirect_uri=${REDIRECT_URI}&code=${code}\`

});

**const** tokenData = **await** tokenRes.json();

**const** accessToken = tokenData.access_token;

**if** (!accessToken) {

  **throw**  **new** Error("Access token retrieval failed.");

}

// 2. 사용자 정보 요청

**const** userRes = **await** fetch("https://kapi.kakao.com/v2/user/me", {

  method: "GET",

  headers: { "Authorization": \`Bearer ${accessToken}\` }

});

**const** userData = **await** userRes.json();

// 사용자 정보 추출

**const** nickname = userData.properties?.nickname || "";

**const** email = userData.kakao_account?.email || "";

**if** (!email) {

  **throw**  **new** Error("Email not provided by Kakao.");

}

// 3. 사용자 DB 확인 및 저장

**const** existing = **await** wixData.query("KakaoUsers").eq("account_email", email).find();

**if** (existing.items.length === 0) {

  **await** wixData.insert("KakaoUsers", {

    nickname,

    account_email: email,

    createdAt: **new** Date()

  });

}

// 4. Wix Members 등록 (로그인은 프론트에서 유도)

**const** member = **await** authentication.register({

  email,

  contactInfo: { nickname }

});

// 5. 사용자 정보 응답

**return** ok({

  headers: { "Content-Type": "application/json" },

  body: {

    memberId: member.id,

    email,

    nickname

  }

});

```

} **catch** (err) {

```
console.error("카카오 로그인 오류:", err);

**return** serverError({ error: err.message });

```

}

}
