संदर्भ
OpenID Connect
PHP नहीं? Identvia मानक OpenID Connect प्रदाता है। कोई प्रमाणित लाइब्रेरी लें और नीचे issuer पर इंगित करें।
अपने 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.
Discovery
| Issuer | https://id.identvia.com |
|---|---|
| Discovery | https://id.identvia.com/.well-known/openid-configuration |
| प्राधिकरण | https://id.identvia.com/oauth/authorize |
| Token | https://id.identvia.com/oauth/token |
| Userinfo | https://id.identvia.com/oauth/userinfo |
| JWKS | https://id.identvia.com/oauth/jwks.json |
| निरस्तीकरण | https://id.identvia.com/oauth/revoke |
| सत्र समाप्ति | https://id.identvia.com/oauth/logout |
Identvia लागू नियम
- केवल authorization code प्रवाह (response_type=code)। कोई implicit या hybrid नहीं।
- पब्लिक क्लाइंट के लिए S256 के साथ PKCE ज़रूरी है (सिंगल-पेज, मोबाइल और नेटिव ऐप), और हर क्लाइंट के लिए इसकी सलाह दी जाती है। client secret से प्रमाणित होने वाले सर्वर-साइड ऐप इसे छोड़ सकते हैं, और OpenID Connect के अनुसार nonce भी छोड़ सकते हैं।
- Redirect URI अक्षर-दर-अक्षर मेल खाएँ। कोई वाइल्डकार्ड/फ़्रैगमेंट नहीं। http://localhost केवल Development में।
- प्राधिकरण कोड एक-बार उपयोग और 60 सेकंड में समाप्त। दोबारा उपयोग से उत्पन्न टोकन रद्द।
- ID tokens RS256 से हस्ताक्षरित। Access tokens 10 मिनट। Refresh tokens (scope offline_access) हर उपयोग पर घूमते हैं; पुराना दोहराने से पूरी श्रृंखला रद्द।
- कॉलबैक में iss (RFC 9207) है। जाँचें।
- sub pairwise है: हर ऐप एक ही व्यक्ति के लिए अलग स्थिर ID देखता है।
1. प्राधिकरण अनुरोध
GET https://id.identvia.com/oauth/authorize
?response_type=code
&client_id=oid_…
&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback
&scope=openid%20email%20profile
&state=<random, 32+ bytes>
&nonce=<random, 32+ bytes>
&code_challenge=<BASE64URL(SHA256(code_verifier))>
&code_challenge_method=S256वैकल्पिक: prompt=none|login|consent, max_age, login_hint।
2. टोकन अनुरोध
POST https://id.identvia.com/oauth/token
Authorization: Basic base64(client_id:client_secret)
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=…&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&code_verifier=…सार्वजनिक क्लाइंट शरीर में सीक्रेट की जगह client_id भेजते हैं।
{
"token_type": "Bearer",
"access_token": "eyJ…",
"expires_in": 600,
"id_token": "eyJ…",
"refresh_token": "…", // केवल offline_access के साथ
"scope": "openid email profile"
}3. ID token सत्यापित करें
- JWKS की मिलती kid कुंजी से हस्ताक्षर सत्यापित करें। केवल RS256 स्वीकारें।
- iss https://id.identvia.com के बराबर; aud में आपका client ID; azp हो तो आपका client ID।
- exp भविष्य में है और iat नहीं (एक मिनट का विचलन अनुमति दें)।
- nonce आपके भेजे से मेल खाए।
- अगर max_age भेजा तो auth_time जाँचें।
Claims
| Scope | Claims |
|---|---|
| openid | sub, auth_time, amr |
| email, email_verified (केवल यदि उपयोगकर्ता साझा करे) | |
| profile | name, given_name, family_name, picture, updated_at (केवल जो उपयोगकर्ता साझा करे) |
| offline_access | एक refresh token |
उपयोगकर्ता सहमति स्क्रीन पर चुनते हैं, इसलिए माँगा scope बिना claims लौट सकता है। संभालें।
नेटिव और डेस्कटॉप ऐप्स
डेवलपर पोर्टल में वातावरण को नेटिव & डेस्कटॉप ऐप के रूप में पंजीकृत करें। रीडायरेक्ट URIs का उपयोग कर सकते हैं:
- निजी-उपयोग URI स्कीम उल्टे-डोमेन रूप में (RFC 8252 §7.1), जैसे कि com.example.app:/oauth/identvia। छोटे स्कीम जैसे myapp: अस्वीकृत हैं।
- दावा किए गए HTTPS ऐप लिंक (iOS यूनिवर्सल लिंक / Android ऐप लिंक)।
- लूपबैक http://127.0.0.1:{port}/… या http://[::1]:{port}/…। कोई भी पोर्ट मेल खाता है; पथ को सटीक रूप से मेल खाना चाहिए (RFC 8252 §7.3)।
iOS 17.4 से पहले: ASWebAuthenticationSession विश्वसनीय रूप से https:// कॉलबैक नहीं लौटाता। उन संस्करणों पर एक निजी-उपयोग स्कीम पसंद करें; iOS 17.4 और उसके बाद यूनिवर्सल लिंक का उपयोग करें।