KakaoLogin component

Hi, all I am creating a login with Kakao to authenticate users and get client id(User information) but while doing, I am facing the following error. Can anyone help with this on how to fix it?

OPTIONS https://kapi.kakao.com/v1/user/me 403 (Forbidden)

AccesHTTP XMLHttpRequest at ‘https://kapi.kakao.com/v1/user/me’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Thanks in advance :slight_smile:

kapi.kakao.com cannot be requested with XMLHttpRequest because CORS is blocked.
If you need to call kapi.kakao.com, such as requesting user information in JavaScript, please use Kakao.API.request in the Kakao.API module of the JavaScript SDK.

Kakao.API.request({
  url: '/v2/user/me',
  success: function(res) {
    alert(JSON.stringify(res));
  },
  fail: function(error) {
    alert(JSON.stringify(error));
  }
});
1개의 좋아요