نقطة نهاية اكتشاف OIDC
تعلّموا كيف تتيح نقطة نهاية اكتشاف OIDC للعملاء استرداد جميع معلومات إعداد OIDC اللازمة برمجيًا.
نقطة نهاية اكتشاف OIDC درس مجاني في OAuth2 & OpenID Connect Deep Dive على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في OAuth2 & OpenID Connect Deep Dive، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة OAuth2 & OpenID Connect Deep Dive 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What is OIDC Discovery?
Imagine you're building an application that needs to connect to an OpenID Provider (IdP) like Google or Auth0. How do you know its authorization URL, token URL, or how to get its public keys?
Manually configuring these details for every IdP is tedious and error-prone. This is where OIDC Discovery comes in!
The Discovery Endpoint
OIDC Discovery provides a standardized way for clients to find all the necessary configuration information of an OpenID Provider.
Instead of hardcoding URLs, your client application can fetch a single JSON document from a well-known URL. This document contains all the endpoints and capabilities of the IdP.
Finding the Discovery Document
Clients typically access the OIDC Discovery document at a specific, standardized URL:
- Base URL of the OpenID Provider
- Followed by
/.well-known/openid-configuration
For example, if your IdP's base URL is https://accounts.example.com, the discovery endpoint would be https://accounts.example.com/.well-known/openid-configuration.
Key Fields: Issuer & JWKS URI
The discovery document is a JSON object with many fields. Two crucial ones are:
issuer: A URL that uniquely identifies the OpenID Provider. It must match theissclaim in ID Tokens.jwks_uri: The URL of the JSON Web Key Set (JWKS) document. This document contains the public keys used by the IdP to sign ID Tokens, allowing your client to verify their authenticity.
Key Fields: Endpoints
The discovery document lists the various endpoints your client will interact with:
authorization_endpoint: Where the user is redirected to grant consent.token_endpoint: Where the client exchanges the authorization code for access and ID tokens.userinfo_endpoint: Where the client can request user profile information after obtaining an access token.end_session_endpoint: (Optional) Where the client can redirect the user to log out from the IdP.
Key Fields: Capabilities
The document also declares the IdP's capabilities:
scopes_supported: A list of the OAuth 2.0scopevalues that this IdP supports.response_types_supported: A list of the OAuth 2.0response_typevalues that this IdP supports.grant_types_supported: (Optional) A list of the OAuth 2.0grant_typevalues that this IdP supports.
These help your client understand what features are available.
Example Discovery Document
Here's a simplified example of what an OIDC Discovery document might look like:
{
"issuer": "https://example.com/openid",
"authorization_endpoint": "https://example.com/openid/auth",
"token_endpoint": "https://example.com/openid/token",
"userinfo_endpoint": "https://example.com/openid/userinfo",
"jwks_uri": "https://example.com/openid/jwks",
"scopes_supported": [
"openid",
"profile",
"email"
],
"response_types_supported": [
"code",
"id_token",
"token id_token"
],
"grant_types_supported": [
"authorization_code",
"implicit",
"refresh_token"
],
"id_token_signing_alg_values_supported": [
"RS256"
]
}How Clients Use Discovery
A client application can perform OIDC Discovery by:
- Fetching the JSON document from the
/.well-known/openid-configurationendpoint. - Parsing the JSON to extract the necessary URLs and capabilities.
- Using these dynamically discovered values to construct authorization requests, exchange tokens, and validate ID Tokens.
This makes client integration much more robust and future-proof.
Benefits of Discovery
Using OIDC Discovery offers several advantages:
- Reduced Configuration: Clients don't need to hardcode IdP endpoints.
- Increased Flexibility: IdPs can change endpoint URLs without breaking clients.
- Enhanced Security: Clients can easily find the
jwks_urito verify ID Token signatures. - Interoperability: Promotes a standardized way for clients to interact with any OIDC-compliant IdP.
Test Your Knowledge
Which of the following fields in the OIDC Discovery document is used by a client to verify the signature of an ID Token?
Recap: OIDC Discovery
We've learned that OIDC Discovery provides a standardized way for clients to find an OpenID Provider's configuration.
- Clients access a well-known
/.well-known/openid-configurationendpoint. - The returned JSON document contains essential URLs (authorization, token, userinfo, jwks) and capabilities (scopes, response types).
- This automation simplifies client setup, improves flexibility, and enhances security by providing necessary public keys for token validation.
الأسئلة الشائعة
هل درس «نقطة نهاية اكتشاف OIDC» مجاني؟
نعم — نص درس «نقطة نهاية اكتشاف OIDC» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة OAuth2 & OpenID Connect Deep Dive، انتقل إلى CoddyKit PRO. تتضمن دورة OAuth2 & OpenID Connect Deep Dive 4 دروس في المجموع.
ماذا ستتعلم في «نقطة نهاية اكتشاف OIDC»؟
تعلّموا كيف تتيح نقطة نهاية اكتشاف OIDC للعملاء استرداد جميع معلومات إعداد OIDC اللازمة برمجيًا. تتمرن على OAuth2 & OpenID Connect Deep Dive مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ OAuth2 & OpenID Connect Deep Dive؟
لا تُشترط خبرة سابقة. OAuth2 & OpenID Connect Deep Dive على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «نقطة نهاية اكتشاف OIDC»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس OAuth2 & OpenID Connect Deep Dive هذا؟
نعم. كل درس في OAuth2 & OpenID Connect Deep Dive يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- التسجيل الديناميكي للعملاء
- نقطة نهاية اكتشاف OIDC
- إدارة الجلسات
- طلب المطالبات والمطالبات المجمّعة