Kakao
For usage, see OAuth 2.0 provider.
import { Kakao } from "arctic";
const kakao = new Kakao(clientId, clientSecret, redirectURI);
const url: URL = await kakao.createAuthorizationURL(state, {
// optional
scopes
});
const tokens: KakaoTokens = await kakao.validateAuthorizationCode(code);
const tokens: KakaoTokens = await kakao.refreshAccessToken(refreshToken);
Get user profile
Use the /user/me
endpoint.
const tokens = await kakao.validateAuthorizationCode(code);
const response = await fetch("https://kapi.kakao.com/v2/user/me", {
headers: {
Authorization: `Bearer ${tokens.accessToken}`
}
});
const user = await response.json();