관리자에게 클라이언트 등록을 요청하여 client_id와 client_secret을 발급받습니다.
GET https://pki.2check.io/api/oauth/authorize ?response_type=code &client_id=YOUR_CLIENT_ID &redirect_uri=https://your-app.com/callback &scope=openid profile email &state=RANDOM_STATE &code_challenge=CODE_CHALLENGE &code_challenge_method=S256
POST https://pki.2check.io/api/oauth/token Content-Type: application/x-www-form-urlencoded grant_type=authorization_code &code=AUTHORIZATION_CODE &redirect_uri=https://your-app.com/callback &client_id=YOUR_CLIENT_ID &client_secret=YOUR_CLIENT_SECRET &code_verifier=CODE_VERIFIER
GET https://pki.2check.io/api/oauth/userinfo Authorization: Bearer ACCESS_TOKEN
| 엔드포인트 | 설명 |
|---|---|
/api/oauth/authorize | Authorization 요청 |
/api/oauth/token | Access Token 발급 |
/api/oauth/userinfo | 사용자 정보 조회 |
/api/oauth/revoke | 토큰 폐기 |
/api/oauth/introspect | 토큰 검증 |
/.well-known/oauth-authorization-server | OAuth2 메타데이터 |
팝업 대신 iframe으로 인증 UI를 임베드할 수 있습니다.
<iframe
id="pki-auth"
src="https://pki.2check.io/auth/iframe"
style="width: 400px; height: 300px; border: none;"
></iframe>
<script>
window.addEventListener('message', (e) => {
if (e.origin !== 'https://pki.2check.io') return;
if (e.data.type === 'PKI_AUTH_RESPONSE') {
const { code, state } = e.data.payload;
// code로 토큰 교환 진행
}
});
// 인증 요청 전송
document.getElementById('pki-auth').contentWindow.postMessage({
type: 'PKI_AUTH_REQUEST',
payload: {
clientId: 'YOUR_CLIENT_ID',
redirectUri: 'https://your-app.com/callback',
scope: 'openid profile',
state: 'RANDOM_STATE'
}
}, 'https://pki.2check.io');
</script>