API 목록으로
🔐 소셜 로그인무료

카카오 로그인

카카오 · Kakao Login API

인증 방식

🔐 OAuth 2.0

요금

무료

Base URL

kauth.kakao.com

태그

OAuth2, 소셜로그인

서비스 소개

카카오 로그인 API는 OAuth 2.0 기반의 소셜 로그인 서비스입니다. 한국 사용자 대부분이 카카오 계정을 보유하고 있어 회원가입 없이 빠른 로그인을 제공할 수 있습니다. 사용자 프로필 정보(닉네임, 이메일, 프로필 이미지)와 카카오톡 친구 목록도 조회할 수 있습니다.

🚀 시작하기

  1. 1

    앱 등록

    developers.kakao.com → 내 애플리케이션 → 앱 추가하기

  2. 2

    Redirect URI 설정

    플랫폼 → Web → 사이트 도메인 등록 → 카카오 로그인 → Redirect URI 추가

  3. 3

    동의항목 설정

    제품 설정 → 카카오 로그인 → 동의항목에서 필요한 항목 체크

  4. 4

    REST API 키 복사

    앱 키 → REST API 키 복사하여 환경변수에 저장

📋 응답 예시

{
  "id": 123456789,
  "kakao_account": {
    "email": "user@kakao.com",
    "profile": {
      "nickname": "홍길동",
      "profile_image_url": "https://k.kakaocdn.net/..."
    }
  }
}

💡 코드 예제

JavaScriptNext.js (NextAuth)
// .env.local
KAKAO_CLIENT_ID=your_rest_api_key
KAKAO_CLIENT_SECRET=your_client_secret

// app/api/auth/[...nextauth]/route.ts
import NextAuth from 'next-auth'
import KakaoProvider from 'next-auth/providers/kakao'

const handler = NextAuth({
  providers: [
    KakaoProvider({
      clientId: process.env.KAKAO_CLIENT_ID!,
      clientSecret: process.env.KAKAO_CLIENT_SECRET!,
    }),
  ],
})

export { handler as GET, handler as POST }
PythonPython (requests)
import requests

# 1. 인가 코드 받기 (브라우저 리다이렉트)
auth_url = (
  "https://kauth.kakao.com/oauth/authorize"
  "?client_id=YOUR_APP_KEY"
  "&redirect_uri=YOUR_REDIRECT_URI"
  "&response_type=code"
)

# 2. 액세스 토큰 발급
def get_token(code: str) -> str:
    res = requests.post(
        "https://kauth.kakao.com/oauth/token",
        data={
            "grant_type": "authorization_code",
            "client_id": "YOUR_APP_KEY",
            "redirect_uri": "YOUR_REDIRECT_URI",
            "code": code,
        },
    )
    return res.json()["access_token"]

# 3. 사용자 정보 조회
def get_user(token: str) -> dict:
    res = requests.get(
        "https://kapi.kakao.com/v2/user/me",
        headers={"Authorization": f"Bearer {token}"},
    )
    return res.json()
cURLcURL
# 액세스 토큰 발급
curl -X POST https://kauth.kakao.com/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "client_id=YOUR_APP_KEY" \
  -d "redirect_uri=YOUR_REDIRECT_URI" \
  -d "code=AUTHORIZATION_CODE"

# 사용자 정보 조회
curl -X GET https://kapi.kakao.com/v2/user/me \
  -H "Authorization: Bearer ACCESS_TOKEN"