API Reference
전체 endpoint 카탈로그.
Base URLs
| 서비스 | URL |
|---|---|
| CP-Auth | https://auth.cp-platform.com |
| CP-Pay | https://pay.cp-platform.com |
| CP-Notify | https://notify.cp-platform.com |
| CP-Tools | https://tools.cp-platform.com |
| CP-API (외부 공개) | https://api.cp-platform.com |
인증 헤더
| 헤더 | 사용처 |
|---|---|
Authorization: Bearer <access_token> | 사용자 토큰 (또는 HttpOnly 쿠키 access_token) |
X-API-Key: <api_key> | 서비스 간 호출, 외부 개발자 |
X-API-Key: <admin_key> | Admin API |
CP-Auth
OAuth
GET
/oauth/loginPOST
/oauth/authorizePOST
/oauth/tokenGET
/oauth/userinfoGET
/oauth/callback사용자 인증·관리
POST
/auth/loginPOST
/auth/signupPOST
/auth/refreshPOST
/auth/logoutPOST
/auth/verifyGET
/auth/mePOST
/auth/oauth/exchangeCP-Pay
단건 결제
POST
/payments/direct/checkoutPOST
/payments/direct/confirm구독 (외부 서비스용 — api-key)
POST
/subscriptions/checkout/externalPOST
/subscriptions/confirm/externalGET
/subscriptions/status/external?user_id={uuid}구독 (CP 사용자 본인 인증)
GET
/subscriptions/plansPOST
/subscriptions/checkout/tossPOST
/subscriptions/confirm/tossGET
/subscriptions/currentPOST
/subscriptions/cancelPOST
/subscriptions/resumeWebhook 관리
PUT
/developers/apps/{app_id}/webhookPOST
/developers/apps/{app_id}/webhook/regenerate-secretGET
/developers/apps/{app_id}/webhook/deliveriesCP-Notify
POST
/notifications/emailPOST
/notifications/smsPOST
/notifications/kakaoPOST
/notifications/pushGET
/notifications/quotasGET
/notifications/usageSDK — @cp-platform/auth-sdk v0.5.2
npm i git+https://github.com/Copark-Dev/cp-auth-sdk.git#v0.5.2타입 정의는 SDK 안에 동봉되어 있어 별도 import 불필요.
Frontend — CpAuthClient
import { CpAuthClient } from "@cp-platform/auth-sdk";
const auth = new CpAuthClient({
authUrl: "https://auth.cp-platform.com",
productOrigin: "https://your-app.com",
// storage: "localStorage" | "memory" | TokenStorage
});
const oauth = await auth.startOAuth("google");
if (!oauth.blocked && "url" in oauth) window.location.assign(oauth.url);
const signup = await auth.signup({ email, password, phone, phone_consent: true });
// signup.status: "authenticated" | "verification_required"
await auth.login(email, password);
await auth.requestPasswordReset(email);
await auth.confirmPasswordReset(token, newPassword);
await auth.verifyEmail(token);
const user = await auth.getMe();
const accessToken = await auth.ensureAccessToken();
auth.isLoggedIn();
await auth.logout();React — CpAuthProvider / useCpAuth
<CpAuthProvider strict>...</CpAuthProvider>
const { guardOAuth } = useCpAuth();
guardOAuth(provider): "proceed" | "redirected" | "blocked";strict 옵션 ON 시 Safari / Chrome / Samsung / Firefox / Edge / Opera / Brave / DuckDuckGo whitelist 외 mobile UA를 in-app으로 처리.
Backend — verifyCpJwt / CpServerClient
import { verifyCpJwt } from "@cp-platform/auth-sdk/jwt";
import { CpServerClient } from "@cp-platform/auth-sdk/server";
const { cpUserId, email } = await verifyCpJwt(bearerToken);
// Supabase JWKS 자동 캐시 (ES256)
const cp = new CpServerClient(); // authUrl 기본값 https://auth.cp-platform.com
const tokens = await cp.exchangeOAuthCode(code, codeVerifier);
const user = await cp.getUserInfo(tokens.access_token);In-app browser helpers
import { detectInAppBrowser, buildChromeIntentUrl } from "@cp-platform/auth-sdk";
const info = detectInAppBrowser(navigator.userAgent, { strict: true });
// { isInApp, appName, isAndroid, isIOS, unknownInApp }
const intent = buildChromeIntentUrl("https://your-app.com/login");
// intent://... — Android 에서 Chrome 으로 link escape지원 패턴 (30+ 명명 앱 + WebView fallback): Meta · WeChat · X · TikTok · Snapchat · Pinterest · Reddit · Discord · Telegram · Slack / KakaoTalk · KakaoStory · Naver · Daum · LINE · BAND · EveryTime · Blind / KakaoBank · KakaoPay · Toss · KB · Woori · Shinhan · Hana · NH · IBK / Coupang · Baemin · Karrot · 11st · SSG · Emart · Lotte · Gmarket.