시작하기
빠른 시작
약 10분 만에 PHP 사이트에 "Identvia로 로그인"을 추가하세요. OpenSSL이 포함된 PHP 8.1 이상이 필요하며, 모든 cPanel 호스트에서 제공됩니다.
AI 에이전트용 프롬프트 복사
코딩 에이전트를 사용하나요? 이 프롬프트는 에이전트가 이 문서를 참고하도록 하고 반드시 지켜야 할 규칙을 알려 줍니다. 에이전트가 작성한 코드도 다른 코드처럼 검토하세요.
You are helping me add "Sign in with Identvia" to my app (PHP). Identvia is an OpenID Connect provider.
Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration
Stack: plain PHP 8.1+ (no framework). Use the official SDK identvia/identvia-php (composer require identvia/identvia-php, or the zip with vendor/ from https://id.identvia.com/developers/docs/php for hosts without Composer). Create identvia.php (config), login.php (redirectToSignIn), callback.php (handleCallback, then session_regenerate_id(true) and store sub) and logout.php. Read secrets from environment variables or a config file outside the web root.
Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.
Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md
Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.
You are helping me add "Sign in with Identvia" to my app (Laravel). Identvia is an OpenID Connect provider.
Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration
Stack: Laravel. Use the official SDK identvia/identvia-php (framework-agnostic) from a small service class bound in a service provider, not a hand-written OAuth client. Add GET /auth/identvia/redirect and GET /auth/identvia/callback routes in the web middleware group. After the callback, find-or-create the user by the Identvia sub (not by email), call Auth::login() and $request->session()->regenerate(). Put the client secret in .env and config/services.php.
Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.
Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md
Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.
You are helping me add "Sign in with Identvia" to my app (Symfony). Identvia is an OpenID Connect provider.
Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration
Stack: Symfony. Use the official SDK identvia/identvia-php wrapped in a service, plus a custom authenticator (AbstractAuthenticator) on the callback route. Map users by the Identvia sub, not email. Keep the client secret in Symfony secrets or env vars, never in committed config.
Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.
Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md
Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.
You are helping me add "Sign in with Identvia" to my app (Node.js). Identvia is an OpenID Connect provider.
Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration
Stack: Node.js. There is no Identvia JavaScript SDK; use a certified OpenID Connect relying-party library (for example openid-client) with discovery from the issuer. Use the authorization code flow with PKCE (S256), state and nonce, keep tokens server-side in the session store, and regenerate the session id after sign-in.
Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.
Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md
Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.
You are helping me add "Sign in with Identvia" to my app (Python). Identvia is an OpenID Connect provider.
Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration
Stack: Python. There is no Identvia Python SDK; use a maintained OpenID Connect client library (for example Authlib) with discovery from the issuer. Use the authorization code flow with PKCE (S256), state and nonce, and keep tokens server-side.
Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.
Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md
Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.
1. 앱 등록
개발자 콘솔을 열고, Identvia 계정으로 로그인한 후 새 앱을 누르세요. 서버 측 사이트(클라이언트 비밀 유지)를 위해 웹 앱을 선택하고, 콜백 URL을 리디렉션 URI로 추가하세요. 예: http://localhost:8000/callback.php. 브라우저 SPA의 경우 단일 페이지 앱을 선택하고, iOS, Android 또는 데스크탑의 경우 네이티브 & 데스크탑 앱을 선택하세요 (개인 사용 스킴, 앱 링크, 루프백).
client ID와 client secret이 표시됩니다. 시크릿은 바로 복사하세요. 한 번만 표시되며 Identvia는 해시만 저장합니다.
첫 번째 환경은 http://localhost를 허용하는 Development입니다. 서비스를 시작할 때 실제 https:// 콜백이 있는 Production 환경을 추가하세요. 별도의 client ID와 시크릿이 발급됩니다.
2. SDK 설치
Composer 사용 시:
composer require identvia/identvia-php다른 플랫폼(JS, 모바일, .NET, WordPress): SDK 및 라이브러리를 보세요.
Composer나 SSH가 없나요? vendor/가 포함된 zip을 다운로드하고, cPanel 파일 관리자에서 사이트 옆에 압축을 푼 뒤 require 'identvia-php/vendor/autoload.php'를 사용하세요.
3. 설정
<?php // identvia.php: 로그인 및 콜백 페이지에서 이 파일을 포함하세요
require __DIR__ . '/vendor/autoload.php';
session_start();
$identvia = new Identvia\Sdk\Identvia([
'issuer' => 'https://id.identvia.com',
'client_id' => getenv('IDENTVIA_CLIENT_ID'),
'client_secret' => getenv('IDENTVIA_CLIENT_SECRET'),
'redirect_uri' => 'http://localhost:8000/callback.php',
'scopes' => ['email', 'profile'],
]);4. 버튼 추가
<a class="identvia-btn" href="/login.php">Sign in with Identvia</a>
<script src="https://id.identvia.com/sdk/v1/button.js" async></script>5. 로그인 시작
<?php // login.php
require __DIR__ . '/identvia.php';
$identvia->redirectToSignIn(['return_to' => '/dashboard.php']);6. 콜백 처리
<?php // callback.php
require __DIR__ . '/identvia.php';
try {
$signIn = $identvia->handleCallback($_GET);
} catch (Identvia\Sdk\Exception\AuthorizationException $e) {
exit($e->userCancelled() ? 'You canceled sign-in.' : 'Sign-in failed.');
} catch (Identvia\Sdk\Exception\IdentviaException $e) {
error_log($e->getMessage());
exit('Sign-in failed. Please try again.');
}
session_regenerate_id(true);
$_SESSION['user_id'] = $signIn->sub(); // 고정값, 앱마다 고유
$_SESSION['email'] = $signIn->email(); // 사용자가 공유한 경우에만
header('Location: ' . ($signIn->returnTo ?? '/'));끝입니다. handleCallback()은 state를 확인하고, PKCE로 코드를 교환하고, Identvia의 키로 ID 토큰 서명을 검증하며, 발급자, 대상, 만료, nonce를 확인합니다. 하나라도 이상하면 예외를 던지고 아무도 로그인되지 않습니다.
사용자 ID로 이메일 주소가 아니라 sub()를 사용하세요. 사용자는 이메일을 바꾸거나 공유하지 않을 수 있으며, sub는 설계상 앱마다 다릅니다.