Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
kakao

providers/kakao

Built-in Kakao integration.

KakaoProfile

https://developers.kakao.com/docs/latest/ko/kakaologin/rest-api#req-user-info type from : https://gist.github.com/ziponia/cdce1ebd88f979b2a6f3f53416b56a77

Extends

  • Record<string, any>

Properties

connected_at?

optional connected_at: string;

has_signed_up?

optional has_signed_up: boolean;

id

id: number;

kakao_account?

optional kakao_account: {
  age_range: AgeRange;
  age_range_needs_agreement: boolean;
  birthday: string;
  birthday_needs_agreement: boolean;
  birthday_type: Birthday;
  birthyear: string;
  birthyear_needs_agreement: boolean;
  ci: string;
  ci_authenticated_at: string;
  ci_needs_agreement: boolean;
  email: string;
  email_needs_agreement: boolean;
  gender: Gender;
  gender_needs_agreement: boolean;
  is_email_valid: boolean;
  is_email_verified: boolean;
  name: string;
  name_needs_agreement: boolean;
  phone_number: string;
  phone_number_needs_agreement: boolean;
  profile: {
     is_default_image: boolean;
     nickname: string;
     profile_image_url: string;
     thumbnail_image_url: string;
  };
  profile_image_needs_agreement: boolean;
  profile_needs_agreement: boolean;
  profile_nickname_needs_agreement: boolean;
};
age_range?
optional age_range: AgeRange;
age_range_needs_agreement?
optional age_range_needs_agreement: boolean;
birthday?
optional birthday: string;
birthday_needs_agreement?
optional birthday_needs_agreement: boolean;
birthday_type?
optional birthday_type: Birthday;
birthyear?
optional birthyear: string;
birthyear_needs_agreement?
optional birthyear_needs_agreement: boolean;
ci?
optional ci: string;
ci_authenticated_at?
optional ci_authenticated_at: string;
ci_needs_agreement?
optional ci_needs_agreement: boolean;
email?
optional email: string;
email_needs_agreement?
optional email_needs_agreement: boolean;
gender?
optional gender: Gender;
gender_needs_agreement?
optional gender_needs_agreement: boolean;
is_email_valid?
optional is_email_valid: boolean;
is_email_verified?
optional is_email_verified: boolean;
name?
optional name: string;
name_needs_agreement?
optional name_needs_agreement: boolean;
phone_number?
optional phone_number: string;
phone_number_needs_agreement?
optional phone_number_needs_agreement: boolean;
profile?
optional profile: {
  is_default_image: boolean;
  nickname: string;
  profile_image_url: string;
  thumbnail_image_url: string;
};
profile.is_default_image?
optional is_default_image: boolean;
profile.nickname?
optional nickname: string;
profile.profile_image_url?
optional profile_image_url: string;
profile.thumbnail_image_url?
optional thumbnail_image_url: string;
profile_image_needs_agreement?
optional profile_image_needs_agreement: boolean;
profile_needs_agreement?
optional profile_needs_agreement: boolean;
profile_nickname_needs_agreement?
optional profile_nickname_needs_agreement: boolean;

properties?

optional properties: {
  id: string;
  msg_blocked: boolean;
  nickname: string;
  profile_image: string;
  registered_at: string;
  status: string;
  thumbnail_image: string;
};
id?
optional id: string;
msg_blocked?
optional msg_blocked: boolean;
nickname?
optional nickname: string;
profile_image?
optional profile_image: string;
registered_at?
optional registered_at: string;
status?
optional status: string;
thumbnail_image?
optional thumbnail_image: string;

synched_at?

optional synched_at: string;

AgeRange

type AgeRange: 
  | "1-9"
  | "10-14"
  | "15-19"
  | "20-29"
  | "30-39"
  | "40-49"
  | "50-59"
  | "60-69"
  | "70-79"
  | "80-89"
  | "90-";

Birthday

type Birthday: "SOLAR" | "LUNAR";

DateTime

type DateTime: string;

Gender

type Gender: "female" | "male";

default()

default<P>(options): OAuthConfig<P>

Add Kakao login to your page.

Setup

Callback URL

https://example.com/api/auth/callback/kakao

Configuration

import { Auth } from "@auth/core"
import Kakao from "@auth/core/providers/kakao"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    Kakao({ clientId: KAKAO_CLIENT_ID, clientSecret: KAKAO_CLIENT_SECRET }),
  ],
})

Resources

Configuration

Create a provider and a Kakao application at https://developers.kakao.com/console/app. In the settings of the app under Kakao Login, activate web app, change consent items and configure callback URL.

Notes

By default, Auth.js assumes that the Kakao provider is based on the OAuth 2 specification.

The “Authorized redirect URIs” used when creating the credentials must include your full domain and end in the callback path. For example;

스크린샷 2023-11-28 오후 9 27 41

  • For production: https://{YOUR_DOMAIN}/api/auth/callback/kakao
  • For development: http://localhost:3000/api/auth/callback/kakao
💡

The Kakao provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

💡

Kakao’s client key is in Summary(It is written as 요약정보 in Korean.) tab’s App Keys Field (My Application > App Settings > Summary)

스크린샷 2023-11-28 오후 9 47 17

Kakao’s clientSecret key is in Security(It is written as 보안 in Korean.) tab’s App Keys Field (My Application > Product Settings > Kakao Login > Security)

스크린샷 2023-11-28 오후 9 38 25

💡

Kakao dev console has a button at the top right to change from KR to ENG

Disclaimer If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Type parameters

Type parameter
P extends KakaoProfile

Parameters

ParameterType
optionsOAuthUserConfig<P>

Returns

OAuthConfig<P>

Auth.js © Balázs Orbán and Team - 2024