यह मॉड्यूल सुरक्षित ऑथराइज़ेशन फ़्लो के लिए OAuth2 PKCE (Proof Key for Code Exchange) प्रमाणीकरण
सुविधा प्रदान करता है। इसमें कोड वेरिफ़ायर जनरेट करना,
टोकन प्रबंधन, और स्वचालित टोकन रीफ़्रेश जैसी क्षमताएँ शामिल हैं।
class xdk.oauth2_auth.OAuth2PKCEAuth
X API के लिए OAuth2 PKCE प्रमाणीकरण।
पैरामीटर
str
डिफ़ॉल्ट:"'https://api.x.com'"
str
डिफ़ॉल्ट:"'https://x.com/i'"
str or None
डिफ़ॉल्ट:"None"
str or None
डिफ़ॉल्ट:"None"
str or None
डिफ़ॉल्ट:"None"
Dict[str, Any] or None
डिफ़ॉल्ट:"None"
str or List[str] or None
डिफ़ॉल्ट:"None"
__init__
OAuth2 PKCE प्रमाणीकरण प्रारंभ करता है।
पैरामीटर
str
डिफ़ॉल्ट:"'https://api.x.com'"
X API टोकन endpoint के लिए base URL (https://api.x.com डिफ़ॉल्ट रूप से सेट है)।
str
डिफ़ॉल्ट:"'https://x.com/i'"
OAuth2 ऑथराइज़ेशन के लिए base URL (https://x.com/i डिफ़ॉल्ट रूप से सेट है)।
str or None
डिफ़ॉल्ट:"None"
X API के लिए client ID।
str or None
डिफ़ॉल्ट:"None"
X API के लिए client secret।
str or None
डिफ़ॉल्ट:"None"
OAuth2 ऑथराइज़ेशन के लिए redirect URI।
Dict[str, Any] or None
डिफ़ॉल्ट:"None"
मौजूदा OAuth2 token dictionary (यदि उपलब्ध हो)।
str or List[str] or None
डिफ़ॉल्ट:"None"
OAuth2 ऑथराइज़ेशन scope के लिए स्पेस से अलग की गई string या strings की सूची।
exchange_code
टोकन के लिए ऑथराइज़ेशन कोड का विनिमय करें (TypeScript API के अनुरूप)।
पैरामीटर
str
कॉलबैक से प्राप्त ऑथराइज़ेशन code।
str or None
डिफ़ॉल्ट:"None"
वैकल्पिक code verifier (यदि प्रदान नहीं किया गया है, तो संग्रहीत verifier का उपयोग किया जाता है)।
रिटर्न
Dictstr, Any
fetch_token
ऑथराइज़ेशन रिस्पॉन्स URL का उपयोग करके टोकन प्राप्त करें (लेगेसी विधि, आंतरिक रूप से exchange_code का उपयोग करती है)।
पैरामीटर
str
ऑथराइज़ेशन के बाद प्राप्त पूरा callback URL
रिटर्न
Dictstr, Any
get_authorization_url
OAuth2 PKCE flow के लिए ऑथराइज़ेशन URL प्राप्त करें।
पैरामीटर
str or None
डिफ़ॉल्ट:"None"
सुरक्षा के लिए एक वैकल्पिक state पैरामीटर।
रिटर्न
str
get_code_challenge
वर्तमान code challenge प्राप्त करता है (PKCE के लिए)।
:returns: वर्तमान code challenge, या सेट न होने पर None।
:rtype: Optional[str]
रिटर्न
str | None
get_code_verifier
वर्तमान code verifier लौटाता है (PKCE के लिए)।
:returns: वर्तमान code verifier, या यदि यह सेट न हो तो None।
:rtype: Optional[str]
रिटर्न
str | None
is_token_expired
जांचें कि टोकन की समय-सीमा समाप्त हो चुकी है या नहीं।
:returns: यदि टोकन की समय-सीमा समाप्त हो चुकी है, तो True; अन्यथा False।
:rtype: bool
रिटर्न
bool
refresh_token
एक्सेस टोकन को रीफ़्रेश करता है।
:returns: रीफ़्रेश किया गया टोकन डिक्शनरी
:rtype: Dict[str, Any]
रिटर्न
Dictstr, Any
set_pkce_parameters
PKCE पैरामीटर को मैन्युअली सेट करें।
पैरामीटर
str
इस्तेमाल किया जाने वाला code verifier.
str or None
डिफ़ॉल्ट:"None"
वैकल्पिक code challenge (अगर नहीं दिया गया है, तो इसे जनरेट किया जाएगा)।
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"X","colors":{"primary":"#0E0E0E","light":"#B0B0B0","dark":"#0E0E0E"},"logo":{"light":"https://mintcdn.com/generaltranslation/p-tsc5qa00w8y5M4/logo/light.svg?fit=max\u0026auto=format\u0026n=p-tsc5qa00w8y5M4\u0026q=85\u0026s=299a991122fb35a82f868bc62a8be1ae","dark":"https://mintcdn.com/generaltranslation/p-tsc5qa00w8y5M4/logo/dark.svg?fit=max\u0026auto=format\u0026n=p-tsc5qa00w8y5M4\u0026q=85\u0026s=06e5086f68ab588cc44787b665898b75"},"favicon":"/favicon.png","appearance":{"default":"dark","strict":true},"background":{"color":{"dark":"#050505"}},"navbar":{"links":[{"href":"https://developer.x.com/en/support","label":"Support"}],"primary":{"type":"button","label":"Developer Console","href":"https://developer.x.com/en/portal/petition/essential/basic-info"}},"footer":{"socials":{"x":"https://x.com/xdevelopers","github":"https://github.com/xdevplatform"},"links":[{"header":"Legal","items":[{"label":"Terms of Service","href":"https://x.com/en/tos"},{"label":"Privacy Policy","href":"https://x.com/en/privacy"},{"label":"Cookies","href":"https://help.x.com/en/rules-and-policies/x-cookies"},{"label":"Developer Terms","href":"https://docs.x.com/developer-terms"}]}]},"seo":{"metatags":{"canonical":"https://docs.x.com","og:site_name":"X Developer Platform","og:type":"website","og:locale":"en_US","twitter:card":"summary_large_image","twitter:site":"@xdevelopers","description":"Build, analyze, and innovate with X's real-time, global data and APIs. Access comprehensive API documentation, SDKs, tutorials, and developer tools.","author":"X Developer Platform","language":"en","robots":"index, follow","googlebot":"index, follow"},"indexing":"all"},"contextual":{"options":["copy","view",{"title":"Open in Grok","description":"Ask questions about this page","icon":"/logo/grok.svg","href":{"base":"https://grok.com","query":[{"key":"q","value":"Read from https://docs.x.com$path so I can ask questions about it."}]}}],"display":"header"},"styling":{"latex":true},"navigation":{"languages":[{"language":"en","href":"overview"},{"language":"es","href":"es/overview"},{"language":"fr","href":"fr/overview"},{"language":"hi","href":"hi/overview"},{"language":"ja","href":"ja/overview"},{"language":"ko","href":"ko/overview"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"generaltranslation","hasAudioNarration":false,"actualSubdomain":"generaltranslation","customDomains":[],"gitSource":{"type":"github","owner":"fernando-aviles","repo":"x-docs","deployBranch":"locadex/setup-1769989792329","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae92afb0a94bfe43457bdcb:success","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"en","tag":"API Reference","count":371},{"language":"es","tag":"Referencia de la API","count":371},{"language":"fr","tag":"Référence de l’API","count":371},{"language":"hi","tag":"API संदर्भ","count":371},{"language":"ja","tag":"APIリファレンス","count":371},{"language":"ko","tag":"API 참조 문서","count":371},{"language":"en","tag":"TypeScript SDK","count":315},{"language":"es","tag":"SDK de TypeScript","count":315},{"language":"fr","tag":"SDK TypeScript","count":315},{"language":"hi","tag":"TypeScript SDK","count":315},{"language":"ja","tag":"TypeScript SDK","count":315},{"language":"ko","tag":"TypeScript SDK","count":315},{"language":"en","tag":"X API","count":295},{"language":"es","tag":"X API","count":294},{"language":"fr","tag":"X API","count":294},{"language":"hi","tag":"X API","count":294},{"language":"ja","tag":"X API","count":294},{"language":"ko","tag":"X API","count":294},{"language":"en","tag":"Interfaces","count":284},{"language":"es","tag":"Interfaces","count":284},{"language":"fr","tag":"Interfaces","count":284},{"language":"hi","tag":"इंटरफेस","count":284},{"language":"ja","tag":"インターフェイス","count":284},{"language":"ko","tag":"인터페이스","count":284},{"language":"en","tag":"Misc","count":281},{"language":"es","tag":"Varios","count":281},{"language":"fr","tag":"Divers","count":281},{"language":"hi","tag":"विविध","count":281},{"language":"ja","tag":"その他","count":281},{"language":"ko","tag":"기타","count":281},{"language":"en","tag":"Posts","count":78},{"language":"es","tag":"Publicaciones","count":78},{"language":"fr","tag":"Publications","count":78},{"language":"hi","tag":"पोस्ट्स","count":78},{"language":"ja","tag":"投稿","count":78},{"language":"ko","tag":"포스트","count":78},{"language":"en","tag":"Guides","count":76},{"language":"es","tag":"Guías","count":76},{"language":"fr","tag":"Guides","count":76},{"language":"ja","tag":"ガイド","count":76},{"language":"ko","tag":"가이드","count":76},{"language":"en","tag":"Python SDK","count":67},{"language":"es","tag":"SDK de Python","count":67},{"language":"fr","tag":"SDK Python","count":67},{"language":"hi","tag":"Python SDK","count":67},{"language":"ja","tag":"Python SDK","count":67},{"language":"ko","tag":"Python SDK","count":67},{"language":"en","tag":"Fundamentals","count":56},{"language":"hi","tag":"मार्गदर्शिकाएँ","count":50},{"language":"es","tag":"Conceptos básicos","count":43},{"language":"ko","tag":"기본 개념","count":43},{"language":"en","tag":"Lists","count":40},{"language":"es","tag":"Listas","count":40},{"language":"fr","tag":"Listes","count":40},{"language":"hi","tag":"सूचियाँ","count":40},{"language":"ja","tag":"リスト","count":40},{"language":"ko","tag":"리스트","count":40},{"language":"hi","tag":"बुनियादी बातें","count":39},{"language":"fr","tag":"Accueil","count":37},{"language":"ja","tag":"ホーム","count":37}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"@font-face{font-family:\"GraphikWide\";src:url(\"https://mintlify-assets.b-cdn.net/x/GraphikWide-Semibold-Trial.woff\") format(\"woff\");font-weight:600}.font-branded,h1,h2,h3{font-family:\"GraphikWide\";letter-spacing:-1%}.form{padding:15px;width:100%;min-height:300px;overflow-y:auto}.rate-limit-table th{text-align:left}tr td[data-label=\"Endpoint\"] a{font-size:12px}tr td[data-label=\"Pro Limit\"],tr td[data-label=\"Basic Limit\"],tr td[data-label=\"Free Limit\"]{font-size:12px}td[data-label=\"Pro Limit\"] strong,td[data-label=\"Basic Limit\"] strong,td[data-label=\"Free Limit\"] strong{margin-bottom:8px;display:block}.text-hero{color:white;font-weight:600;font-size:3rem;margin:0}@media (max-width: 767px){.text-hero{font-size:2rem}}#assistant-entry span{font-size:0!important;line-height:0!important}#assistant-entry span::before{content:\"Ask Grok\";font-size:0.875rem;line-height:1.5rem}#assistant-entry svg{display:none!important}#assistant-entry::before{content:\"\";display:inline-block;width:18px;height:18px;background-image:url(\"data:image/svg+xml,%3Csvg fill='%23000000' fill-rule='evenodd' height='1em' style='flex:none;line-height:1' viewBox='0 0 24 24' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Ctitle%3EGrok%3C/title%3E%3Cpath d='M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain;vertical-align:middle}.dark #assistant-entry::before{background-image:url(\"data:image/svg+xml,%3Csvg fill='%23ffffff' fill-rule='evenodd' height='1em' style='flex:none;line-height:1' viewBox='0 0 24 24' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Ctitle%3EGrok%3C/title%3E%3Cpath d='M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815'/%3E%3C/svg%3E\")}.chat-assistant-sheet-header span.font-semibold{font-size:0!important}.chat-assistant-sheet-header span.font-semibold::before{content:\"Grok\";font-size:0.875rem;font-weight:600}.chat-assistant-sheet-header svg.size-5.text-primary.dark\\:text-primary-light{display:none!important}.chat-assistant-sheet-header .flex.items-center.gap-2::before{content:\"\";display:inline-block;width:18px;height:18px;background-image:url(\"data:image/svg+xml,%3Csvg fill='%23000000' fill-rule='evenodd' height='1em' style='flex:none;line-height:1' viewBox='0 0 24 24' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Ctitle%3EGrok%3C/title%3E%3Cpath d='M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain;vertical-align:middle}.dark .chat-assistant-sheet-header .flex.items-center.gap-2::before{background-image:url(\"data:image/svg+xml,%3Csvg fill='%23ffffff' fill-rule='evenodd' height='1em' style='flex:none;line-height:1' viewBox='0 0 24 24' width='1em' xmlns='http://www.w3.org/2000/svg'%3E%3Ctitle%3EGrok%3C/title%3E%3Cpath d='M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815'/%3E%3C/svg%3E\")}[data-component-part=\"update-label\"]{background-color:white;color:black!important}#navbar>*:nth-child(2){max-width:none!important;margin-left:0!important;margin-right:0!important}#sidebar{left:0!important}#sidebar-content{padding-left:2rem}#injected-slider{max-width:400px}#cost-estimator-button{position:relative}#cost-estimator-dropdown{min-width:400px;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)}#usage-slider{-webkit-appearance:none;appearance:none;height:6px;background:#e5e7eb;outline:none;border-radius:3px}.dark #usage-slider{background:rgba(255, 255, 255, 0.1)}#usage-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:white;border:2px solid #00BA7C;border-radius:50%;cursor:pointer}.dark #usage-slider::-webkit-slider-thumb{background:#0B0C0E}#usage-slider::-moz-range-thumb{width:16px;height:16px;background:white;border:2px solid #00BA7C;border-radius:50%;cursor:pointer}.dark #usage-slider::-moz-range-thumb{background:#0B0C0E}"}],"page":{"pagePath":"hi/xdks/python/reference/xdk.oauth2_auth","slug":"/hi/xdks/python/reference/xdk.oauth2_auth","pageMetadata":{"title":"OAuth2PKCEAuth","sidebarTitle":"OAuth2PKCEAuth","description":null,"href":"/hi/xdks/python/reference/xdk.oauth2_auth","hidden":true},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,..._provideComponents(),...props.components},{Heading,ParamField}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`यह मॉड्यूल सुरक्षित ऑथराइज़ेशन फ़्लो के लिए OAuth2 PKCE (Proof Key for Code Exchange) प्रमाणीकरण\nसुविधा प्रदान करता है। इसमें कोड वेरिफ़ायर जनरेट करना,\nटोकन प्रबंधन, और स्वचालित टोकन रीफ़्रेश जैसी क्षमताएँ शामिल हैं।`}),`\n`,_jsx(`div`,{id:`class-xdkoauth2_authoauth2pkceauth`,children:_jsx(Heading,{level:`3`,id:`class-xdk-oauth2_auth-oauth2pkceauth`,children:_jsx(_components.code,{children:`class xdk.oauth2_auth.OAuth2PKCEAuth`})})}),`\n`,_jsx(_components.p,{children:`X API के लिए OAuth2 PKCE प्रमाणीकरण।`}),`\n`,_jsx(`div`,{id:`parameters`,children:_jsx(Heading,{level:`4`,id:`पैरामीटर`,children:`पैरामीटर`})}),`\n`,_jsx(ParamField,{path:`path.base_url`,type:`str`,default:`'https://api.x.com'`,id:`param-path-base-url`}),`\n`,_jsx(ParamField,{path:`path.authorization_base_url`,type:`str`,default:`'https://x.com/i'`,id:`param-path-authorization-base-url`}),`\n`,_jsx(ParamField,{path:`path.client_id`,type:`str or None`,default:`None`,id:`param-path-client-id`}),`\n`,_jsx(ParamField,{path:`path.client_secret`,type:`str or None`,default:`None`,id:`param-path-client-secret`}),`\n`,_jsx(ParamField,{path:`path.redirect_uri`,type:`str or None`,default:`None`,id:`param-path-redirect-uri`}),`\n`,_jsx(ParamField,{path:`path.token`,type:`Dict[str, Any] or None`,default:`None`,id:`param-path-token`}),`\n`,_jsx(ParamField,{path:`path.scope`,type:`str or List[str] or None`,default:`None`,id:`param-path-scope`}),`\n`,_jsx(`div`,{id:`__init__`,children:_jsx(Heading,{level:`3`,id:`__init__`,children:_jsx(_components.code,{children:`__init__`})})}),`\n`,_jsx(_components.p,{children:`OAuth2 PKCE प्रमाणीकरण प्रारंभ करता है।`}),`\n`,_jsx(`div`,{id:`parameters`,children:_jsx(Heading,{level:`4`,id:`पैरामीटर-2`,children:`पैरामीटर`})}),`\n`,_jsx(ParamField,{path:`path.base_url`,type:`str`,default:`'https://api.x.com'`,id:`param-path-base-url-1`,children:_jsxs(_components.p,{children:[`X API टोकन endpoint के लिए base URL (`,_jsx(_components.a,{href:`https://api.x.com`,children:`https://api.x.com`}),` डिफ़ॉल्ट रूप से सेट है)।`]})}),`\n`,_jsx(ParamField,{path:`path.authorization_base_url`,type:`str`,default:`'https://x.com/i'`,id:`param-path-authorization-base-url-1`,children:_jsxs(_components.p,{children:[`OAuth2 ऑथराइज़ेशन के लिए base URL (`,_jsx(_components.a,{href:`https://x.com/i`,children:`https://x.com/i`}),` डिफ़ॉल्ट रूप से सेट है)।`]})}),`\n`,_jsx(ParamField,{path:`path.client_id`,type:`str or None`,default:`None`,id:`param-path-client-id-1`,children:_jsx(_components.p,{children:`X API के लिए client ID।`})}),`\n`,_jsx(ParamField,{path:`path.client_secret`,type:`str or None`,default:`None`,id:`param-path-client-secret-1`,children:_jsx(_components.p,{children:`X API के लिए client secret।`})}),`\n`,_jsx(ParamField,{path:`path.redirect_uri`,type:`str or None`,default:`None`,id:`param-path-redirect-uri-1`,children:_jsx(_components.p,{children:`OAuth2 ऑथराइज़ेशन के लिए redirect URI।`})}),`\n`,_jsx(ParamField,{path:`path.token`,type:`Dict[str, Any] or None`,default:`None`,id:`param-path-token-1`,children:_jsx(_components.p,{children:`मौजूदा OAuth2 token dictionary (यदि उपलब्ध हो)।`})}),`\n`,_jsx(ParamField,{path:`path.scope`,type:`str or List[str] or None`,default:`None`,id:`param-path-scope-1`,children:_jsx(_components.p,{children:`OAuth2 ऑथराइज़ेशन scope के लिए स्पेस से अलग की गई string या strings की सूची।`})}),`\n`,_jsx(`div`,{id:`exchange_code`,children:_jsx(Heading,{level:`3`,id:`exchange_code`,children:_jsx(_components.code,{children:`exchange_code`})})}),`\n`,_jsx(_components.p,{children:`टोकन के लिए ऑथराइज़ेशन कोड का विनिमय करें (TypeScript API के अनुरूप)।`}),`\n`,_jsx(`div`,{id:`parameters`,children:_jsx(Heading,{level:`4`,id:`पैरामीटर-3`,children:`पैरामीटर`})}),`\n`,_jsx(ParamField,{path:`path.code`,type:`str`,id:`param-path-code`,children:_jsx(_components.p,{children:`कॉलबैक से प्राप्त ऑथराइज़ेशन code।`})}),`\n`,_jsx(ParamField,{path:`path.code_verifier`,type:`str or None`,default:`None`,id:`param-path-code-verifier`,children:_jsx(_components.p,{children:`वैकल्पिक code verifier (यदि प्रदान नहीं किया गया है, तो संग्रहीत verifier का उपयोग किया जाता है)।`})}),`\n`,_jsx(`div`,{id:`returns`,children:_jsx(Heading,{level:`4`,id:`रिटर्न`,children:`रिटर्न`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`Dictstr, Any`})}),`\n`,_jsx(`div`,{id:`fetch_token`,children:_jsx(Heading,{level:`3`,id:`fetch_token`,children:_jsx(_components.code,{children:`fetch_token`})})}),`\n`,_jsx(_components.p,{children:`ऑथराइज़ेशन रिस्पॉन्स URL का उपयोग करके टोकन प्राप्त करें (लेगेसी विधि, आंतरिक रूप से exchange_code का उपयोग करती है)।`}),`\n`,_jsx(`div`,{id:`parameters`,children:_jsx(Heading,{level:`4`,id:`पैरामीटर-4`,children:`पैरामीटर`})}),`\n`,_jsx(ParamField,{path:`path.authorization_response`,type:`str`,id:`param-path-authorization-response`,children:_jsx(_components.p,{children:`ऑथराइज़ेशन के बाद प्राप्त पूरा callback URL`})}),`\n`,_jsx(`div`,{id:`returns`,children:_jsx(Heading,{level:`4`,id:`रिटर्न-2`,children:`रिटर्न`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`Dictstr, Any`})}),`\n`,_jsx(`div`,{id:`get_authorization_url`,children:_jsx(Heading,{level:`3`,id:`get_authorization_url`,children:_jsx(_components.code,{children:`get_authorization_url`})})}),`\n`,_jsx(_components.p,{children:`OAuth2 PKCE flow के लिए ऑथराइज़ेशन URL प्राप्त करें।`}),`\n`,_jsx(`div`,{id:`parameters`,children:_jsx(Heading,{level:`4`,id:`पैरामीटर-5`,children:`पैरामीटर`})}),`\n`,_jsx(ParamField,{path:`path.state`,type:`str or None`,default:`None`,id:`param-path-state`,children:_jsx(_components.p,{children:`सुरक्षा के लिए एक वैकल्पिक state पैरामीटर।`})}),`\n`,_jsx(`div`,{id:`returns`,children:_jsx(Heading,{level:`4`,id:`रिटर्न-3`,children:`रिटर्न`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`str`})}),`\n`,_jsx(`div`,{id:`get_code_challenge`,children:_jsx(Heading,{level:`3`,id:`get_code_challenge`,children:_jsx(_components.code,{children:`get_code_challenge`})})}),`\n`,_jsx(_components.p,{children:`वर्तमान code challenge प्राप्त करता है (PKCE के लिए)।\n:returns: वर्तमान code challenge, या सेट न होने पर None।\n:rtype: Optional[str]`}),`\n`,_jsx(`div`,{id:`returns`,children:_jsx(Heading,{level:`4`,id:`रिटर्न-4`,children:`रिटर्न`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`str | None`})}),`\n`,_jsx(`div`,{id:`get_code_verifier`,children:_jsx(Heading,{level:`3`,id:`get_code_verifier`,children:_jsx(_components.code,{children:`get_code_verifier`})})}),`\n`,_jsx(_components.p,{children:`वर्तमान code verifier लौटाता है (PKCE के लिए)।\n:returns: वर्तमान code verifier, या यदि यह सेट न हो तो None।\n:rtype: Optional[str]`}),`\n`,_jsx(`div`,{id:`returns`,children:_jsx(Heading,{level:`4`,id:`रिटर्न-5`,children:`रिटर्न`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`str | None`})}),`\n`,_jsx(`div`,{id:`is_token_expired`,children:_jsx(Heading,{level:`3`,id:`is_token_expired`,children:_jsx(_components.code,{children:`is_token_expired`})})}),`\n`,_jsx(_components.p,{children:`जांचें कि टोकन की समय-सीमा समाप्त हो चुकी है या नहीं।\n:returns: यदि टोकन की समय-सीमा समाप्त हो चुकी है, तो True; अन्यथा False।\n:rtype: bool`}),`\n`,_jsx(`div`,{id:`returns`,children:_jsx(Heading,{level:`4`,id:`रिटर्न-6`,children:`रिटर्न`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`bool`})}),`\n`,_jsx(`div`,{id:`refresh_token`,children:_jsx(Heading,{level:`3`,id:`refresh_token`,children:_jsx(_components.code,{children:`refresh_token`})})}),`\n`,_jsx(_components.p,{children:`एक्सेस टोकन को रीफ़्रेश करता है।\n:returns: रीफ़्रेश किया गया टोकन डिक्शनरी\n:rtype: Dict[str, Any]`}),`\n`,_jsx(`div`,{id:`returns`,children:_jsx(Heading,{level:`4`,id:`रिटर्न-7`,children:`रिटर्न`})}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`Dictstr, Any`})}),`\n`,_jsx(`div`,{id:`set_pkce_parameters`,children:_jsx(Heading,{level:`3`,id:`set_pkce_parameters`,children:_jsx(_components.code,{children:`set_pkce_parameters`})})}),`\n`,_jsx(_components.p,{children:`PKCE पैरामीटर को मैन्युअली सेट करें।`}),`\n`,_jsx(`div`,{id:`parameters`,children:_jsx(Heading,{level:`4`,id:`पैरामीटर-6`,children:`पैरामीटर`})}),`\n`,_jsx(ParamField,{path:`path.code_verifier`,type:`str`,id:`param-path-code-verifier-1`,children:_jsx(_components.p,{children:`इस्तेमाल किया जाने वाला code verifier.`})}),`\n`,_jsx(ParamField,{path:`path.code_challenge`,type:`str or None`,default:`None`,id:`param-path-code-challenge`,children:_jsx(_components.p,{children:`वैकल्पिक code challenge (अगर नहीं दिया गया है, तो इसे जनरेट किया जाएगा)।`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"OAuth2PKCEAuth","sidebarTitle":"OAuth2PKCEAuth","description":null,"href":"/hi/xdks/python/reference/xdk.oauth2_auth","hidden":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"class xdk.oauth2_auth.OAuth2PKCEAuth","slug":"class-xdk-oauth2_auth-oauth2pkceauth","depth":3,"children":[]},{"title":"पैरामीटर","slug":"पैरामीटर","depth":4,"children":[]},{"title":"__init__","slug":"__init__","depth":3,"children":[]},{"title":"पैरामीटर","slug":"पैरामीटर-2","depth":4,"children":[]},{"title":"exchange_code","slug":"exchange_code","depth":3,"children":[]},{"title":"पैरामीटर","slug":"पैरामीटर-3","depth":4,"children":[]},{"title":"रिटर्न","slug":"रिटर्न","depth":4,"children":[]},{"title":"fetch_token","slug":"fetch_token","depth":3,"children":[]},{"title":"पैरामीटर","slug":"पैरामीटर-4","depth":4,"children":[]},{"title":"रिटर्न","slug":"रिटर्न-2","depth":4,"children":[]},{"title":"get_authorization_url","slug":"get_authorization_url","depth":3,"children":[]},{"title":"पैरामीटर","slug":"पैरामीटर-5","depth":4,"children":[]},{"title":"रिटर्न","slug":"रिटर्न-3","depth":4,"children":[]},{"title":"get_code_challenge","slug":"get_code_challenge","depth":3,"children":[]},{"title":"रिटर्न","slug":"रिटर्न-4","depth":4,"children":[]},{"title":"get_code_verifier","slug":"get_code_verifier","depth":3,"children":[]},{"title":"रिटर्न","slug":"रिटर्न-5","depth":4,"children":[]},{"title":"is_token_expired","slug":"is_token_expired","depth":3,"children":[]},{"title":"रिटर्न","slug":"रिटर्न-6","depth":4,"children":[]},{"title":"refresh_token","slug":"refresh_token","depth":3,"children":[]},{"title":"रिटर्न","slug":"रिटर्न-7","depth":4,"children":[]},{"title":"set_pkce_parameters","slug":"set_pkce_parameters","depth":3,"children":[]},{"title":"पैरामीटर","slug":"पैरामीटर-6","depth":4,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/generaltranslation/f67e695317871503/widgets.js","/_mintlify/custom/generaltranslation/dd4721d49d6e0698/sliders.js"],"subdomain":"generaltranslation","siteName":"X","title":"OAuth2PKCEAuth - X","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/xdks/python/reference/xdk.oauth2_auth","matchLevel":1,"hidden":true},"es":{"href":"/es/xdks/python/reference/xdk.oauth2_auth","matchLevel":1,"hidden":true},"fr":{"href":"/fr/xdks/python/reference/xdk.oauth2_auth","matchLevel":1,"hidden":true},"hi":{"href":"/hi/xdks/python/reference/xdk.oauth2_auth","matchLevel":0},"ja":{"href":"/ja/xdks/python/reference/xdk.oauth2_auth","matchLevel":1,"hidden":true},"ko":{"href":"/ko/xdks/python/reference/xdk.oauth2_auth","matchLevel":1,"hidden":true}}},"lastModified":"2026-04-02T03:58:09.125Z","originalFileLocation":"hi/xdks/python/reference/xdk.oauth2_auth.mdx","locale":"hi"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"dark\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Build, analyze, and innovate with X\u0026#x27;s real-time, global data and APIs. Access comprehensive API documentation, SDKs, tutorials, and developer tools.\">\u003cmeta data-mint-head name=\"application-name\" content=\"X\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"index, follow\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"OAuth2PKCEAuth - X\">\u003cmeta data-mint-head property=\"og:description\" content=\"Build, analyze, and innovate with X\u0026#x27;s real-time, global data and APIs. Access comprehensive API documentation, SDKs, tutorials, and developer tools.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"X Developer Platform\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://generaltranslation.mintlify.site/_mintlify/api/og/v2?division=OAuth2+%E0%A4%AA%E0%A5%8D%E0%A4%B0%E0%A4%AE%E0%A4%BE%E0%A4%A3%E0%A5%80%E0%A4%95%E0%A4%B0%E0%A4%A3\u0026amp;title=OAuth2PKCEAuth\u0026amp;theme=3199bd2c292b5ac8dc3f7441\u0026amp;signature=edb03bd628cf4a3092d64086500f3a88e57ce865a2403d9f68b9bdcfbc0b3274\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"OAuth2PKCEAuth - X\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Build, analyze, and innovate with X\u0026#x27;s real-time, global data and APIs. Access comprehensive API documentation, SDKs, tutorials, and developer tools.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://generaltranslation.mintlify.site/_mintlify/api/og/v2?division=OAuth2+%E0%A4%AA%E0%A5%8D%E0%A4%B0%E0%A4%AE%E0%A4%BE%E0%A4%A3%E0%A5%80%E0%A4%95%E0%A4%B0%E0%A4%A3\u0026amp;title=OAuth2PKCEAuth\u0026amp;theme=3199bd2c292b5ac8dc3f7441\u0026amp;signature=edb03bd628cf4a3092d64086500f3a88e57ce865a2403d9f68b9bdcfbc0b3274\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/generaltranslation/3OgqNYd4DMBAanRo/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"X\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0E0E0E\">\u003cmeta data-mint-head name=\"og:locale\" content=\"en_US\">\u003cmeta data-mint-head name=\"author\" content=\"X Developer Platform\">\u003cmeta data-mint-head name=\"language\" content=\"en\">\u003cmeta data-mint-head name=\"googlebot\" content=\"index, follow\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/hi/xdks/python/reference/xdk.oauth2_auth.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"hi\" href=\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.x.com/xdks/python/reference/xdk.oauth2_auth\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"es\" href=\"https://docs.x.com/es/xdks/python/reference/xdk.oauth2_auth\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"fr\" href=\"https://docs.x.com/fr/xdks/python/reference/xdk.oauth2_auth\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ja\" href=\"https://docs.x.com/ja/xdks/python/reference/xdk.oauth2_auth\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ko\" href=\"https://docs.x.com/ko/xdks/python/reference/xdk.oauth2_auth\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.x.com/xdks/python/reference/xdk.oauth2_auth\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.x.com/#organization\",\"name\":\"X\",\"url\":\"https://docs.x.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/generaltranslation/p-tsc5qa00w8y5M4/logo/light.svg?fit=max\u0026auto=format\u0026n=p-tsc5qa00w8y5M4\u0026q=85\u0026s=299a991122fb35a82f868bc62a8be1ae\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.x.com#website\",\"name\":\"X\",\"url\":\"https://docs.x.com\",\"publisher\":{\"@id\":\"https://docs.x.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth#webpage\",\"url\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth\",\"name\":\"OAuth2PKCEAuth\",\"dateModified\":\"2026-04-02T03:58:09.125Z\",\"isPartOf\":{\"@id\":\"https://docs.x.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API संदर्भ\",\"item\":\"https://docs.x.com/hi/xdks/python/reference/modules\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"कोर\",\"item\":\"https://docs.x.com/hi/xdks/python/reference/xdk.account_activity\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"OAuth2PKCEAuth\",\"item\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth#article\",\"headline\":\"OAuth2PKCEAuth\",\"name\":\"OAuth2PKCEAuth\",\"url\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth\",\"mainEntityOfPage\":{\"@id\":\"https://docs.x.com/hi/xdks/python/reference/xdk.oauth2_auth#webpage\"},\"dateModified\":\"2026-04-02T03:58:09.125Z\",\"publisher\":{\"@id\":\"https://docs.x.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.x.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"X\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"X\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/hi/xdks/python/reference/xdk.oauth2_auth.md","siteName":"X","nav":{"global":null,"languages":[{"language":"en","pages":[{"title":"en","href":"/xdks/python/reference/xdk.oauth2_auth"}]},{"language":"es","pages":[{"title":"es","href":"/es/xdks/python/reference/xdk.oauth2_auth"}]},{"language":"fr","pages":[{"title":"fr","href":"/fr/xdks/python/reference/xdk.oauth2_auth"}]},{"language":"hi","tabs":[{"tab":"मुखपृष्ठ","pages":[{"title":"मुखपृष्ठ","href":"/hi/overview"}]},{"tab":"X API","pages":[{"title":"X API","href":"/hi/x-api/introduction"}]},{"tab":"X Ads API","pages":[{"title":"X Ads API","href":"/hi/x-ads-api/introduction"}]},{"tab":"XDKs","pages":[{"title":"XDKs","href":"/hi/xdks/overview"}]},{"tab":"ट्यूटोरियल","pages":[{"title":"ट्यूटोरियल","href":"/hi/tutorials/explore-a-users-posts"}]},{"tab":"उपयोग परिदृश्य","pages":[{"title":"उपयोग परिदृश्य","href":"/hi/use-cases/build-for-business"}]},{"tab":"सफलता की कहानियाँ","pages":[{"title":"सफलता की कहानियाँ","href":"/hi/success-stories"}]},{"tab":"स्थिति","pages":[{"title":"स्थिति","href":"/hi/status"}]},{"tab":"चेंजलॉग","pages":[{"title":"चेंजलॉग","href":"/hi/changelog"}]},{"tab":"Python SDK","hidden":true,"pages":[{"title":"Python XDK","sidebarTitle":"परिचय","description":null,"href":"/hi/xdks/python/overview"},{"title":"इंस्टॉल करें","sidebarTitle":"इंस्टॉल करें","description":null,"href":"/hi/xdks/python/install"},{"title":"त्वरित शुरुआत","sidebarTitle":"त्वरित शुरुआत","description":null,"href":"/hi/xdks/python/quickstart"},{"title":"प्रमाणीकरण","sidebarTitle":"प्रमाणीकरण","description":null,"href":"/hi/xdks/python/authentication"},{"title":"पेजिनेशन","sidebarTitle":"पेजिनेशन","description":null,"href":"/hi/xdks/python/pagination"},{"title":"स्ट्रीमिंग","sidebarTitle":"स्ट्रीमिंग","description":null,"href":"/hi/xdks/python/streaming"},{"group":"API संदर्भ","pages":[{"title":"xdk","sidebarTitle":"xdk","description":null,"href":"/hi/xdks/python/reference/modules"},{"group":"क्लाइंट्स","pages":[{"group":"Account Activity","pages":[{"title":"AccountActivityClient","sidebarTitle":"AccountActivityClient","description":null,"href":"/hi/xdks/python/reference/xdk.account_activity.client"}]},{"group":"गतिविधि","pages":[{"title":"ActivityClient","sidebarTitle":"ActivityClient","description":null,"href":"/hi/xdks/python/reference/xdk.activity.client"}]},{"group":"Client","pages":[{"title":"Client","sidebarTitle":"Client","description":null,"href":"/hi/xdks/python/reference/xdk.client"}]},{"group":"Communities","pages":[{"title":"CommunitiesClient","sidebarTitle":"CommunitiesClient","description":null,"href":"/hi/xdks/python/reference/xdk.communities.client"}]},{"group":"Community Notes","pages":[{"title":"CommunityNotesClient","sidebarTitle":"CommunityNotesClient","description":null,"href":"/hi/xdks/python/reference/xdk.community_notes.client"}]},{"group":"कंप्लायंस","pages":[{"title":"ComplianceClient","sidebarTitle":"ComplianceClient","description":null,"href":"/hi/xdks/python/reference/xdk.compliance.client"}]},{"group":"कनेक्शंस","pages":[{"title":"ConnectionsClient","sidebarTitle":"ConnectionsClient","description":null,"href":"/hi/xdks/python/reference/xdk.connections.client"}]},{"group":"डायरेक्ट मैसेज","pages":[{"title":"DirectMessagesClient","sidebarTitle":"DirectMessagesClient","description":null,"href":"/hi/xdks/python/reference/xdk.direct_messages.client"}]},{"group":"सामान्य","pages":[{"title":"GeneralClient","sidebarTitle":"GeneralClient","description":null,"href":"/hi/xdks/python/reference/xdk.general.client"}]},{"group":"सूचियाँ","pages":[{"title":"ListsClient","sidebarTitle":"ListsClient","description":null,"href":"/hi/xdks/python/reference/xdk.lists.client"}]},{"group":"मीडिया","pages":[{"title":"MediaClient","sidebarTitle":"MediaClient","description":null,"href":"/hi/xdks/python/reference/xdk.media.client"}]},{"group":"समाचार","pages":[{"title":"NewsClient","sidebarTitle":"NewsClient","description":null,"href":"/hi/xdks/python/reference/xdk.news.client"}]},{"group":"पोस्ट्स","pages":[{"title":"PostsClient","sidebarTitle":"PostsClient","description":null,"href":"/hi/xdks/python/reference/xdk.posts.client"}]},{"group":"Spaces","pages":[{"title":"SpacesClient","sidebarTitle":"SpacesClient","description":null,"href":"/hi/xdks/python/reference/xdk.spaces.client"}]},{"group":"स्ट्रीम","pages":[{"title":"StreamClient","sidebarTitle":"StreamClient","description":null,"href":"/hi/xdks/python/reference/xdk.stream.client"}]},{"group":"ट्रेंड्स","pages":[{"title":"TrendsClient","sidebarTitle":"TrendsClient","description":null,"href":"/hi/xdks/python/reference/xdk.trends.client"}]},{"group":"उपयोग","pages":[{"title":"UsageClient","sidebarTitle":"UsageClient","description":null,"href":"/hi/xdks/python/reference/xdk.usage.client"}]},{"group":"उपयोगकर्ता","pages":[{"title":"UsersClient","sidebarTitle":"UsersClient","description":null,"href":"/hi/xdks/python/reference/xdk.users.client"}]},{"group":"वेबहुक्स","pages":[{"title":"WebhooksClient","sidebarTitle":"WebhooksClient","description":null,"href":"/hi/xdks/python/reference/xdk.webhooks.client"}]}]},{"group":"मॉडल्स","pages":[{"group":"Account Activity","pages":[{"title":"Account_activity.Models","sidebarTitle":"Account_activity.Models","description":null,"href":"/hi/xdks/python/reference/xdk.account_activity.models"}]},{"group":"गतिविधि","pages":[{"title":"Activity.Models","sidebarTitle":"Activity.Models","description":null,"href":"/hi/xdks/python/reference/xdk.activity.models"}]},{"group":"Communities","pages":[{"title":"Communities.Models","sidebarTitle":"Communities.Models","description":null,"href":"/hi/xdks/python/reference/xdk.communities.models"}]},{"group":"Community Notes","pages":[{"title":"Community_notes.Models","sidebarTitle":"Community_notes.Models","description":null,"href":"/hi/xdks/python/reference/xdk.community_notes.models"}]},{"group":"कंप्लायंस","pages":[{"title":"Compliance.Models","sidebarTitle":"Compliance.Models","description":null,"href":"/hi/xdks/python/reference/xdk.compliance.models"}]},{"group":"कनेक्शंस","pages":[{"title":"Connections.Models","sidebarTitle":"Connections.Models","description":null,"href":"/hi/xdks/python/reference/xdk.connections.models"}]},{"group":"डायरेक्ट मैसेज","pages":[{"title":"Direct_messages.Models","sidebarTitle":"Direct_messages.Models","description":null,"href":"/hi/xdks/python/reference/xdk.direct_messages.models"}]},{"group":"सामान्य","pages":[{"title":"General.Models","sidebarTitle":"General.Models","description":null,"href":"/hi/xdks/python/reference/xdk.general.models"}]},{"group":"सूचियाँ","pages":[{"title":"Lists.Models","sidebarTitle":"Lists.Models","description":null,"href":"/hi/xdks/python/reference/xdk.lists.models"}]},{"group":"मीडिया","pages":[{"title":"Media.Models","sidebarTitle":"Media.Models","description":null,"href":"/hi/xdks/python/reference/xdk.media.models"}]},{"group":"समाचार","pages":[{"title":"News.Models","sidebarTitle":"News.Models","description":null,"href":"/hi/xdks/python/reference/xdk.news.models"}]},{"group":"पोस्ट्स","pages":[{"title":"Posts.Models","sidebarTitle":"Posts.Models","description":null,"href":"/hi/xdks/python/reference/xdk.posts.models"}]},{"group":"Spaces","pages":[{"title":"Spaces.Models","sidebarTitle":"Spaces.Models","description":null,"href":"/hi/xdks/python/reference/xdk.spaces.models"}]},{"group":"स्ट्रीम","pages":[{"title":"Stream.Models","sidebarTitle":"Stream.Models","description":null,"href":"/hi/xdks/python/reference/xdk.stream.models"}]},{"group":"ट्रेंड्स","pages":[{"title":"Trends.Models","sidebarTitle":"Trends.Models","description":null,"href":"/hi/xdks/python/reference/xdk.trends.models"}]},{"group":"उपयोग","pages":[{"title":"Usage.Models","sidebarTitle":"Usage.Models","description":null,"href":"/hi/xdks/python/reference/xdk.usage.models"}]},{"group":"उपयोगकर्ता","pages":[{"title":"Users.Models","sidebarTitle":"Users.Models","description":null,"href":"/hi/xdks/python/reference/xdk.users.models"}]},{"group":"वेबहुक्स","pages":[{"title":"Webhooks.Models","sidebarTitle":"Webhooks.Models","description":null,"href":"/hi/xdks/python/reference/xdk.webhooks.models"}]}]},{"group":"कोर","pages":[{"group":"Account Activity","pages":[{"title":"AccountActivityClient","sidebarTitle":"AccountActivityClient","description":null,"href":"/hi/xdks/python/reference/xdk.account_activity"}]},{"group":"गतिविधि","pages":[{"title":"ActivityClient","sidebarTitle":"ActivityClient","description":null,"href":"/hi/xdks/python/reference/xdk.activity"}]},{"group":"समुदाय","pages":[{"title":"CommunitiesClient","sidebarTitle":"CommunitiesClient","description":null,"href":"/hi/xdks/python/reference/xdk.communities"}]},{"group":"Community Notes","pages":[{"title":"CommunityNotesClient","sidebarTitle":"CommunityNotesClient","description":null,"href":"/hi/xdks/python/reference/xdk.community_notes"}]},{"group":"अनुपालन","pages":[{"title":"ComplianceClient","sidebarTitle":"ComplianceClient","description":null,"href":"/hi/xdks/python/reference/xdk.compliance"}]},{"group":"कनेक्शन","pages":[{"title":"ConnectionsClient","sidebarTitle":"ConnectionsClient","description":null,"href":"/hi/xdks/python/reference/xdk.connections"}]},{"group":"डायरेक्ट मैसेज","pages":[{"title":"DirectMessagesClient","sidebarTitle":"DirectMessagesClient","description":null,"href":"/hi/xdks/python/reference/xdk.direct_messages"}]},{"group":"सामान्य","pages":[{"title":"GeneralClient","sidebarTitle":"GeneralClient","description":null,"href":"/hi/xdks/python/reference/xdk.general"}]},{"group":"सूचियाँ","pages":[{"title":"ListsClient","sidebarTitle":"ListsClient","description":null,"href":"/hi/xdks/python/reference/xdk.lists"}]},{"group":"मीडिया","pages":[{"title":"MediaClient","sidebarTitle":"MediaClient","description":null,"href":"/hi/xdks/python/reference/xdk.media"}]},{"group":"समाचार","pages":[{"title":"NewsClient","sidebarTitle":"NewsClient","description":null,"href":"/hi/xdks/python/reference/xdk.news"}]},{"group":"OAuth1 प्रमाणीकरण","pages":[{"title":"oauth1_auth","sidebarTitle":"oauth1_auth","description":null,"href":"/hi/xdks/python/reference/xdk.oauth1_auth"}]},{"group":"OAuth2 प्रमाणीकरण","pages":[{"title":"OAuth2PKCEAuth","sidebarTitle":"OAuth2PKCEAuth","href":"/hi/xdks/python/reference/xdk.oauth2_auth"}]},{"group":"पैजिनेटर","pages":[{"title":"paginator","sidebarTitle":"paginator","description":null,"href":"/hi/xdks/python/reference/xdk.paginator"}]},{"group":"पोस्ट्स","pages":[{"title":"PostsClient","sidebarTitle":"PostsClient","description":null,"href":"/hi/xdks/python/reference/xdk.posts"}]},{"group":"Spaces","pages":[{"title":"SpacesClient","sidebarTitle":"SpacesClient","description":null,"href":"/hi/xdks/python/reference/xdk.spaces"}]},{"group":"स्ट्रीम","pages":[{"title":"StreamClient","sidebarTitle":"StreamClient","description":null,"href":"/hi/xdks/python/reference/xdk.stream"}]},{"group":"स्ट्रीमिंग","pages":[{"title":"स्ट्रीमिंग","sidebarTitle":"स्ट्रीमिंग","description":null,"href":"/hi/xdks/python/reference/xdk.streaming"}]},{"group":"ट्रेंड्स","pages":[{"title":"TrendsClient","sidebarTitle":"TrendsClient","description":null,"href":"/hi/xdks/python/reference/xdk.trends"}]},{"group":"उपयोग","pages":[{"title":"UsageClient","sidebarTitle":"UsageClient","description":null,"href":"/hi/xdks/python/reference/xdk.usage"}]},{"group":"उपयोगकर्ता","pages":[{"title":"UsersClient","sidebarTitle":"UsersClient","description":null,"href":"/hi/xdks/python/reference/xdk.users"}]},{"group":"वेबहुक्स","pages":[{"title":"WebhooksClient","sidebarTitle":"WebhooksClient","description":null,"href":"/hi/xdks/python/reference/xdk.webhooks"}]},{"group":"Xdk","pages":[{"title":"Client","sidebarTitle":"Client","description":null,"href":"/hi/xdks/python/reference/xdk"}]}]}]}]},{"tab":"TypeScript SDK","hidden":true,"pages":[{"title":"TypeScript SDK","href":"/hi/xdks/typescript/overview"}]}],"global":{"anchors":[{"anchor":"डेवलपर कंसोल","icon":"circle-play","href":"https://developer.x.com/en/portal/petition/essential/basic-info"},{"anchor":"फ़ोरम","icon":"messages","href":"https://devcommunity.x.com"},{"anchor":"GitHub","icon":"github","href":"https://github.com/xdevplatform"}]}},{"language":"ja","pages":[{"title":"ja","href":"/ja/xdks/python/reference/xdk.oauth2_auth"}]},{"language":"ko","pages":[{"title":"ko","href":"/ko/xdks/python/reference/xdk.oauth2_auth"}]}]},"basePath":"","title":"OAuth2PKCEAuth - X","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}