{"id":117055,"date":"2026-10-22T13:00:55","date_gmt":"2026-10-22T05:00:55","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/117055.html"},"modified":"2026-10-22T13:00:55","modified_gmt":"2026-10-22T05:00:55","slug":"%e4%bd%bf%e7%94%a8-django-oauth-toolkit-3-2-0-%e6%9e%84%e5%bb%ba-django-oauth2-%e4%b8%8e-openid-connect-%e6%8e%88%e6%9d%83%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%9a%e4%bb%8e%e6%9c%80%e5%b0%8f%e9%85%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/117055.html","title":{"rendered":"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357"},"content":{"rendered":"<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011context-hub<\/h3>\n<p class=\"gcb-project-desc\">\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/co\/context-hub<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<p>\u672c\u7bc7\u6307\u5357\u4ee5 Context Hub \u7ef4\u62a4\u7684 django-oauth-toolkit \u6587\u6863 \u4e3a\u9aa8\u67b6&#xff0c;\u7cfb\u7edf\u8bb2\u89e3\u5982\u4f55\u628a\u4e00\u4e2a Django \u9879\u76ee\u6539\u9020\u6210 OAuth 2.0 \u6388\u6743\u670d\u52a1\u5668&#xff08;Authorization Server&#xff09;&#xff1a;\u8986\u76d6\u6700\u5c0f\u5316\u914d\u7f6e\u3001\u5ba2\u6237\u7aef\u6ce8\u518c\u3001\u6388\u6743\u7801 &#043; PKCE \u6d41\u7a0b\u3001Django REST Framework \u9274\u6743\u3001OpenID Connect \u6269\u5c55\u3001\u5206\u79bb\u5f0f\u8d44\u6e90\u670d\u52a1\u5668\u6a21\u5f0f&#xff0c;\u4ee5\u53ca\u4ece 3.0.0 \u5230 3.2.0 \u7684\u5347\u7ea7\u8981\u70b9\u3002\u8bfb\u5b8c\u672c\u6587&#xff0c;\u4f60\u5c06\u80fd\u591f\u5728\u81ea\u5df1\u7684 Django \u9879\u76ee\u4e2d\u72ec\u7acb\u642d\u5efa\u5e76\u8fd0\u7ef4\u4e00\u4e2a\u652f\u6301\u6388\u6743\u7801\u3001\u5237\u65b0\u4ee4\u724c\u4e0e OIDC \u7684\u6388\u6743\u670d\u52a1&#xff0c;\u5e76\u5b89\u5168\u5730\u4fdd\u62a4\u7b2c\u4e00\u65b9\u4e0e\u7b2c\u4e09\u65b9\u5ba2\u6237\u7aef\u8bbf\u95ee\u7684 REST API\u3002<\/p>\n<h3>\u4e00\u3001django-oauth-toolkit \u662f\u4ec0\u4e48<\/h3>\n<p>django-oauth-toolkit&#xff08;\u4e0b\u6587\u7b80\u79f0 DOT&#xff09;\u662f\u4e00\u4e2a Python \u5305&#xff0c;\u4f5c\u7528\u662f\u628a\u4e00\u4e2a Django \u9879\u76ee\u53d8\u6210 OAuth 2.0 \u6388\u6743\u670d\u52a1\u5668\u3002\u5b83\u63d0\u4f9b\u7684\u80fd\u529b\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\u6388\u6743&#xff08;authorization&#xff09;\u6d41\u7a0b\u5904\u7406<\/li>\n<li>\u8bbf\u95ee\u4ee4\u724c&#xff08;access token&#xff09;\u7b7e\u53d1\u4e0e\u6821\u9a8c<\/li>\n<li>\u4ee4\u724c\u64a4\u9500&#xff08;revocation&#xff09;<\/li>\n<li>\u4ee4\u724c introspection&#xff08;\u5185\u7701\u6821\u9a8c&#xff09;<\/li>\n<li>\u5ba2\u6237\u7aef\u5e94\u7528&#xff08;Application&#xff09;\u7ba1\u7406<\/li>\n<li>Django REST framework&#xff08;DRF&#xff09;\u5b98\u65b9\u96c6\u6210<\/li>\n<li>\u53ef\u9009\u7684 OpenID Connect&#xff08;OIDC&#xff09;\u652f\u6301<\/li>\n<\/ul>\n<p>\u5b83\u7684\u5178\u578b\u4f7f\u7528\u573a\u666f\u662f&#xff1a;\u4f60\u7684 Django \u5e94\u7528\u9700\u8981\u4e3a\u7b2c\u4e00\u65b9\u6216\u7b2c\u4e09\u65b9\u5ba2\u6237\u7aef\u7b7e\u53d1\u5e76\u6821\u9a8c OAuth \u4ee4\u724c&#xff0c;\u4f8b\u5982\u81ea\u5efa\u7684\u79fb\u52a8\u7aef App\u3001SPA\u3001\u547d\u4ee4\u884c\u5de5\u5177\u6216\u7b2c\u4e09\u65b9\u5408\u4f5c\u4f19\u4f34\u5e94\u7528\u9700\u8981\u8bbf\u95ee\u4f60\u670d\u52a1\u7684\u53d7\u4fdd\u62a4\u8d44\u6e90\u3002<\/p>\n<p>\u9700\u8981\u7279\u522b\u5f3a\u8c03\u7684\u662f\u5b83\u7684\u8fb9\u754c&#xff1a;DOT \u662f\u4e00\u4e2a\u6388\u6743\u670d\u52a1\u5668\u5de5\u5177\u5305&#xff08;authorization server toolkit&#xff09;&#xff0c;\u4e0d\u662f\u793e\u4ea4\u767b\u5f55\u5ba2\u6237\u7aef\u5e93\u3002\u4e0d\u8981\u7528\u5b83\u6765\u505a&#034;\u7528 Google\/GitHub \u8d26\u53f7\u767b\u5f55\u6211\u7684\u7f51\u7ad9&#034;\u8fd9\u7c7b\u9700\u6c42\u2014\u2014\u90a3\u662f OAuth 2.0 \u5ba2\u6237\u7aef&#xff08;social login \/ third-party client&#xff09;\u7684\u5de5\u4f5c&#xff0c;\u5e94\u5f53\u4ea4\u7ed9\u4e13\u95e8\u7684\u5ba2\u6237\u7aef\u5e93\u3002<\/p>\n<p>\u5728 Context Hub \u4e2d&#xff0c;\u8fd9\u4efd\u6587\u6863\u662f django \u4f5c\u8005\u76ee\u5f55\u4e0b\u7684\u4e00\u4e2a\u591a\u8bed\u8a00\u6587\u6863\u6761\u76ee&#xff08;Python \u53d8\u4f53&#xff09;&#xff0c;\u5176 YAML frontmatter \u6807\u6ce8\u4e86 name: oauth-toolkit\u3001languages: &#034;python&#034;\u3001versions: &#034;3.2.0&#034;\u3001source: maintainer&#xff0c;\u5e76\u5e26\u6709 django,oauth2,openid-connect,drf,authentication,authorization \u6807\u7b7e&#xff0c;\u4f9b Agent \u901a\u8fc7 chub \u68c0\u7d22\u83b7\u53d6&#xff08;\u8be6\u89c1 docs\/content-guide.md \u5bf9 DOC.md \u7ed3\u6784\u7684\u7ea6\u5b9a&#xff09;\u3002<\/p>\n<h3>\u4e8c\u3001\u7248\u672c\u4e0a\u4e0b\u6587\u4e0e\u517c\u5bb9\u6027<\/h3>\n<ul>\n<li>\u751f\u6001&#xff1a;pypi<\/li>\n<li>\u5305\u540d&#xff1a;django-oauth-toolkit<\/li>\n<li>\u672c\u6587\u8986\u76d6\u7248\u672c&#xff1a;3.2.0<\/li>\n<li>\u6587\u6863\u4fee\u8ba2&#xff1a;revision: 1&#xff0c;\u66f4\u65b0\u4e8e 2026-03-12<\/li>\n<\/ul>\n<p>\u5173\u4e8e\u517c\u5bb9\u6027&#xff0c;\u5b98\u65b9\u6587\u6863\u7684 3.2.0 \u5feb\u7167\u7ed9\u51fa\u7684\u652f\u6301\u8303\u56f4\u662f&#xff1a;Python 3.10 \u81f3 3.14\u3001Django 4.2 \u81f3 6.0\u3001oauthlib&gt;&#061;3.2.2\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f&#xff0c;\u4e0a\u6e38\u5404\u4fe1\u606f\u9762\u4e4b\u95f4\u5b58\u5728\u8f7b\u5fae\u4e0d\u4e00\u81f4&#xff1a;PyPI \u9879\u76ee\u9875\u7684\u90e8\u5206\u5206\u533a\u4ecd\u663e\u793a\u65e7\u7684\u4f9d\u8d56\u8bf4\u660e\u4e0e\u5206\u7c7b\u5668\u6587\u672c\u3002\u56e0\u6b64\u5728\u505a\u5347\u7ea7\u51b3\u7b56\u65f6&#xff0c;\u5e94\u4ee5\u5b98\u65b9\u6587\u6863\u6839\u9875\u9762 &#043; changelog \u4e3a\u51c6&#xff0c;\u800c\u4e0d\u662f\u4f9d\u8d56 PyPI \u9875\u9762\u4e0a\u53ef\u80fd\u8fc7\u65f6\u7684\u63cf\u8ff0\u6587\u5b57\u3002<\/p>\n<h3>\u4e09\u3001\u5b89\u88c5<\/h3>\n<p>\u6700\u5c0f\u5b89\u88c5\u53ea\u9700 pip&#xff1a;<\/p>\n<p>pip install django-oauth-toolkit&#061;&#061;3.2.0<\/p>\n<p>\u5982\u679c\u4f60\u7684\u76ee\u7684\u662f\u4fdd\u62a4 Django REST framework \u7684 API&#xff0c;\u9700\u8981\u4e00\u5e76\u5b89\u88c5 DRF&#xff1a;<\/p>\n<p>pip install django-oauth-toolkit&#061;&#061;3.2.0 djangorestframework<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u628a oauth2_provider \u52a0\u5165 INSTALLED_APPS \u5e76\u6267\u884c\u8fc1\u79fb\u5373\u53ef&#xff08;\u89c1\u4e0b\u4e00\u8282&#xff09;\u3002<\/p>\n<h3>\u56db\u3001\u6700\u5c0f\u5316\u6388\u6743\u670d\u52a1\u5668\u914d\u7f6e<\/h3>\n<h4>1. \u4fee\u6539 settings.py<\/h4>\n<p>\u6dfb\u52a0\u5e94\u7528\u3001\u5b9a\u4e49 scope\u3001\u4fdd\u6301 PKCE \u5f00\u542f&#xff1a;<\/p>\n<p># settings.py<\/p>\n<p>INSTALLED_APPS &#061; [<br \/>\n    # Django apps&#8230;<br \/>\n    &#034;oauth2_provider&#034;,<br \/>\n]<\/p>\n<p>OAUTH2_PROVIDER &#061; {<br \/>\n    &#034;SCOPES&#034;: {<br \/>\n        &#034;read&#034;: &#034;Read access&#034;,<br \/>\n        &#034;write&#034;: &#034;Write access&#034;,<br \/>\n    },<br \/>\n    &#034;PKCE_REQUIRED&#034;: True,<br \/>\n}<\/p>\n<p>\u8fd9\u91cc\u6709\u4e24\u4e2a\u5173\u952e\u70b9&#xff1a;<\/p>\n<ul>\n<li>SCOPES \u5b9a\u4e49\u4e86\u4f60\u7684\u4ee4\u724c\u53ef\u4ee5\u8bf7\u6c42\u7684\u6240\u6709 scope\u3002\u5ba2\u6237\u7aef\u7533\u8bf7\u4ee4\u724c\u65f6\u5fc5\u987b\u5728\u6b64\u96c6\u5408\u8303\u56f4\u5185\u53d6\u503c&#xff0c;\u672a\u58f0\u660e\u7684 scope \u4e0d\u4f1a\u88ab\u7b7e\u53d1\u3002<\/li>\n<li>PKCE_REQUIRED \u9ed8\u8ba4\u5373\u4e3a True&#xff08;\u4e0b\u6587\u8bbe\u7f6e\u4e00\u8282\u4f1a\u518d\u6b21\u5f3a\u8c03&#xff09;&#xff0c;\u610f\u5473\u7740\u6240\u6709\u6388\u6743\u7801\u6d41\u7a0b\u9ed8\u8ba4\u5f3a\u5236\u8981\u6c42 PKCE \u8bc1\u660e\u5bc6\u94a5\u4ea4\u6362\u3002<\/li>\n<\/ul>\n<h4>2. \u66b4\u9732 OAuth \u7aef\u70b9<\/h4>\n<p>DOT \u81ea\u5e26\u4e00\u5957\u5b8c\u6574\u7684\u8def\u7531&#xff0c;\u901a\u8fc7 include \u6302\u8f7d\u5373\u53ef&#xff0c;\u4e60\u60ef\u4e0a\u6302\u8f7d\u5728 \/o\/ \u524d\u7f00\u4e0b&#xff1a;<\/p>\n<p># urls.py<br \/>\nfrom django.urls import include, path<br \/>\nfrom oauth2_provider import urls as oauth2_urls<\/p>\n<p>urlpatterns &#061; [<br \/>\n    path(&#034;o\/&#034;, include(oauth2_urls)),<br \/>\n]<\/p>\n<h4>3. \u6267\u884c\u8fc1\u79fb\u5e76\u521b\u5efa\u7ba1\u7406\u5458<\/h4>\n<p>python manage.py migrate<br \/>\npython manage.py createsuperuser<\/p>\n<p>\u8fc1\u79fb\u4f1a\u521b\u5efa DOT \u7684\u6a21\u578b\u8868&#xff08;oauth2_provider_application\u3001oauth2_provider_accesstoken\u3001oauth2_provider_refreshtoken\u3001oauth2_provider_grant \u7b49&#xff09;\u3002\u968f\u540e\u5728 Django admin \u7684 Applications \u83dc\u5355\u4e0b\u5373\u53ef\u521b\u5efa\u5ba2\u6237\u7aef\u5e94\u7528\u3002<\/p>\n<h3>\u4e94\u3001\u6ce8\u518c\u5ba2\u6237\u7aef\u5e94\u7528<\/h3>\n<h4>\u901a\u8fc7 Django admin \u6ce8\u518c<\/h4>\n<p>\u5bf9\u4e8e\u5927\u591a\u6570\u6d4f\u89c8\u5668\u3001SPA \u548c\u79fb\u52a8\u7aef\u5ba2\u6237\u7aef&#xff0c;\u521b\u5efa\u5e94\u7528\u65f6\u7684\u5173\u952e\u9009\u9879\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u914d\u7f6e\u9879\u5efa\u8bae\u53d6\u503c\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>Grant type<\/td>\n<td>Authorization code<\/td>\n<td>\u6700\u901a\u7528\u3001\u6700\u5b89\u5168\u7684\u6388\u6743\u7801\u6388\u6743\u7c7b\u578b<\/td>\n<\/tr>\n<tr>\n<td>Client type<\/td>\n<td>Public&#xff08;SPA\/\u539f\u751f\u5e94\u7528&#xff09;&#xff1b;Confidential&#xff08;\u670d\u52a1\u7aef\u5e94\u7528&#xff09;<\/td>\n<td>\u51b3\u5b9a\u80fd\u5426\u5b89\u5168\u6301\u6709 client secret<\/td>\n<\/tr>\n<tr>\n<td>Redirect URIs<\/td>\n<td>\u7cbe\u786e\u7684\u56de\u8c03 URI<\/td>\n<td>\u5fc5\u987b\u662f\u5b8c\u5168\u5339\u914d\u7684 URI&#xff0c;\u4e0d\u8981\u968f\u610f\u5199\u901a\u914d\u7b26<\/td>\n<\/tr>\n<tr>\n<td>Allowed origins<\/td>\n<td>\u6d4f\u89c8\u5668\u7aef\u5ba2\u6237\u7aef\u6240\u9700\u7684\u8de8\u57df\u6765\u6e90<\/td>\n<td>\u6d4f\u89c8\u5668\u7aef\u5ba2\u6237\u7aef\u4ece\u53e6\u4e00\u4e2a origin \u8c03\u7528\u4ee4\u724c\u7aef\u70b9\u65f6\u9700\u8981<\/td>\n<\/tr>\n<tr>\n<td>PKCE<\/td>\n<td>\u9ed8\u8ba4\u542f\u7528<\/td>\n<td>\u65b0\u7248\u9ed8\u8ba4\u8981\u6c42 PKCE<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5bf9\u4e8e Confidential&#xff08;\u673a\u5bc6&#xff09;\u5ba2\u6237\u7aef&#xff0c;\u9700\u8981\u6ce8\u610f&#xff1a;DOT \u5728\u65b0\u7248\u672c\u4e2d\u4f1a\u5728\u4fdd\u5b58\u65f6\u5bf9\u5ba2\u6237\u7aef\u5bc6\u94a5\u505a\u54c8\u5e0c\u5904\u7406&#xff0c;\u56e0\u6b64\u5982\u679c\u4f60\u9700\u8981\u5728\u670d\u52a1\u5668\u4e4b\u5916\u4f7f\u7528\u660e\u6587\u5bc6\u94a5&#xff0c;\u5fc5\u987b\u5728\u521b\u5efa\u65f6\u7acb\u5373\u590d\u5236\u4fdd\u5b58\u2014\u2014\u4e4b\u540e\u65e0\u6cd5\u518d\u4ece Django admin \u4e2d\u6062\u590d\u660e\u6587\u3002<\/p>\n<h4>\u901a\u8fc7\u7ba1\u7406\u547d\u4ee4\u7a0b\u5e8f\u5316\u521b\u5efa<\/h4>\n<p>DOT \u5185\u7f6e\u4e86 createapplication \u7ba1\u7406\u547d\u4ee4&#xff0c;\u9002\u5408\u811a\u672c\u5316\u3001\u53ef\u91cd\u590d\u7684\u521b\u5efa\u573a\u666f&#xff1a;<\/p>\n<p>python manage.py createapplication \\\\<br \/>\n  &#034;web-app&#034; \\\\<br \/>\n  admin \\\\<br \/>\n  authorization-code \\\\<br \/>\n  confidential \\\\<br \/>\n  &#034;https:\/\/app.example.com\/callback&#034;<\/p>\n<p>\u53c2\u6570\u4f9d\u6b21\u4e3a&#xff1a;\u5e94\u7528\u540d\u79f0\u3001\u7528\u6237&#xff08;\u6b64\u5904\u4e3a admin&#xff09;\u3001\u6388\u6743\u7c7b\u578b\u3001\u5ba2\u6237\u7aef\u7c7b\u578b\u3001\u91cd\u5b9a\u5411 URI\u3002\u521b\u5efa\u5b8c\u6210\u540e&#xff0c;\u4ece\u6570\u636e\u5e93\u6216\u547d\u4ee4\u8f93\u51fa\u4e2d\u53d6\u51fa client_id&#xff08;\u4ee5\u53ca\u673a\u5bc6\u5ba2\u6237\u7aef\u7684 client_secret&#xff0c;\u82e5\u9700\u8981\u5916\u90e8\u4f7f\u7528\u987b\u53ca\u65f6\u4fdd\u5b58&#xff09;\u3002<\/p>\n<h3>\u516d\u3001\u6388\u6743\u7801\u6d41\u7a0b&#xff08;Authorization Code Flow&#xff09;<\/h3>\n<h4>\u6d41\u7a0b\u6982\u89c8<\/h4>\n<p>\u6700\u5e38\u89c1\u7684 OAuth 2.0 \u6388\u6743\u7801\u6d41\u7a0b\u5305\u542b\u56db\u6b65&#xff1a;<\/p>\n<li>\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230 \/o\/authorize\/&#xff1b;<\/li>\n<li>\u5728\u4f60\u7684\u91cd\u5b9a\u5411 URI \u4e0a\u6536\u5230\u6388\u6743\u7801&#xff08;authorization code&#xff09;&#xff1b;<\/li>\n<li>\u7528\u6388\u6743\u7801\u5728 \/o\/token\/ \u6362\u53d6\u8bbf\u95ee\u4ee4\u724c&#xff1b;<\/li>\n<li>\u5c06 Bearer \u4ee4\u724c\u53d1\u9001\u5230\u53d7\u4fdd\u62a4\u7684 API\u3002<\/li>\n<h4>\u6784\u9020\u6388\u6743 URL&#xff08;\u516c\u5f00 PKCE \u5ba2\u6237\u7aef&#xff09;<\/h4>\n<p>from urllib.parse import urlencode<\/p>\n<p>params &#061; urlencode(<br \/>\n    {<br \/>\n        &#034;client_id&#034;: &#034;YOUR_CLIENT_ID&#034;,<br \/>\n        &#034;response_type&#034;: &#034;code&#034;,<br \/>\n        &#034;redirect_uri&#034;: &#034;https:\/\/app.example.com\/callback&#034;,<br \/>\n        &#034;scope&#034;: &#034;read write&#034;,<br \/>\n        &#034;code_challenge&#034;: &#034;BASE64URL_SHA256_CODE_VERIFIER&#034;,<br \/>\n        &#034;code_challenge_method&#034;: &#034;S256&#034;,<br \/>\n    }<br \/>\n)<\/p>\n<p>authorize_url &#061; f&#034;https:\/\/auth.example.com\/o\/authorize\/?{params}&#034;<\/p>\n<p>\u5176\u4e2d code_challenge \u662f\u539f\u59cb code_verifier \u7ecf\u8fc7 SHA-256 \u54c8\u5e0c\u540e\u518d\u8fdb\u884c base64url \u7f16\u7801\u7684\u7ed3\u679c&#xff0c;code_challenge_method \u56fa\u5b9a\u4e3a S256\u3002\u8fd9\u662f PKCE \u7684\u6838\u5fc3&#xff1a;\u6388\u6743\u8bf7\u6c42\u9636\u6bb5\u53ea\u63d0\u4ea4\u54c8\u5e0c\u540e\u7684\u6311\u6218\u503c&#xff0c;\u4ee4\u724c\u4ea4\u6362\u9636\u6bb5\u624d\u63d0\u4ea4\u539f\u59cb\u9a8c\u8bc1\u503c&#xff0c;\u4ece\u800c\u907f\u514d\u6388\u6743\u7801\u88ab\u622a\u83b7\u540e\u76f4\u63a5\u5192\u7528\u3002<\/p>\n<h4>\u5151\u6362\u4ee4\u724c&#xff08;\u516c\u5f00 PKCE \u5ba2\u6237\u7aef&#xff09;<\/h4>\n<p>import requests<\/p>\n<p>response &#061; requests.post(<br \/>\n    &#034;https:\/\/auth.example.com\/o\/token\/&#034;,<br \/>\n    data&#061;{<br \/>\n        &#034;grant_type&#034;: &#034;authorization_code&#034;,<br \/>\n        &#034;client_id&#034;: &#034;YOUR_CLIENT_ID&#034;,<br \/>\n        &#034;code&#034;: &#034;CODE_FROM_CALLBACK&#034;,<br \/>\n        &#034;redirect_uri&#034;: &#034;https:\/\/app.example.com\/callback&#034;,<br \/>\n        &#034;code_verifier&#034;: &#034;ORIGINAL_CODE_VERIFIER&#034;,<br \/>\n    },<br \/>\n    timeout&#061;30,<br \/>\n)<br \/>\nresponse.raise_for_status()<br \/>\ntoken &#061; response.json()<\/p>\n<p>\u8fd4\u56de\u7684 token \u4e2d\u901a\u5e38\u5305\u542b access_token\u3001token_type: &#034;Bearer&#034;\u3001expires_in\u3001scope&#xff0c;\u4ee5\u53ca&#xff08;\u5982\u679c\u7533\u8bf7\u4e86 offline_access \u6216\u914d\u7f6e\u5141\u8bb8\u65f6&#xff09;refresh_token\u3002<\/p>\n<h4>\u673a\u5bc6\u5ba2\u6237\u7aef\u5982\u4f55\u4ea4\u6362<\/h4>\n<p>\u5bf9\u4e8e Confidential&#xff08;\u673a\u5bc6&#xff09;\u5ba2\u6237\u7aef&#xff0c;\u4ee4\u724c\u4ea4\u6362\u8bf7\u6c42\u5e94\u4f7f\u7528 HTTP Basic \u8ba4\u8bc1\u643a\u5e26 client_id \u4e0e client_secret \u5bf9\u6388\u6743\u670d\u52a1\u5668\u8fdb\u884c\u8eab\u4efd\u8ba4\u8bc1&#xff0c;\u800c\u4e0d\u662f\u628a\u5e94\u7528\u5f53\u4f5c\u7eaf PKCE \u516c\u5f00\u5ba2\u6237\u7aef\u6765\u5904\u7406\u3002\u4e5f\u5c31\u662f\u8bf4&#xff1a;\u673a\u5bc6\u5ba2\u6237\u7aef\u540c\u6837\u53ef\u4ee5\u914d\u5408 PKCE&#xff08;\u63a8\u8350&#xff09;&#xff0c;\u4f46\u8eab\u4efd\u51ed\u8bc1\u5fc5\u987b\u6b63\u786e\u4f20\u9012\u3002<\/p>\n<h3>\u4e03\u3001\u4fdd\u62a4 Django REST Framework API<\/h3>\n<p>DOT \u4e0e DRF \u7684\u96c6\u6210\u901a\u8fc7 oauth2_provider.contrib.rest_framework \u6a21\u5757\u5b9e\u73b0&#xff0c;\u6838\u5fc3\u662f OAuth2Authentication \u8ba4\u8bc1\u7c7b\u548c\u4e00\u7ec4 scope \u611f\u77e5\u7684\u6743\u9650\u7c7b\u3002<\/p>\n<h4>\u5168\u5c40\u914d\u7f6e\u8ba4\u8bc1\u7c7b<\/h4>\n<p># settings.py<br \/>\nREST_FRAMEWORK &#061; {<br \/>\n    &#034;DEFAULT_AUTHENTICATION_CLASSES&#034;: (<br \/>\n        &#034;oauth2_provider.contrib.rest_framework.OAuth2Authentication&#034;,<br \/>\n    ),<br \/>\n}<\/p>\n<h4>\u5728\u89c6\u56fe\u4e2d\u7ec4\u5408\u8ba4\u8bc1\u4e0e\u6743\u9650<\/h4>\n<p># views.py<br \/>\nfrom oauth2_provider.contrib.rest_framework import (<br \/>\n    OAuth2Authentication,<br \/>\n    TokenHasReadWriteScope,<br \/>\n)<br \/>\nfrom rest_framework.response import Response<br \/>\nfrom rest_framework.views import APIView<\/p>\n<p>class DocumentView(APIView):<br \/>\n    authentication_classes &#061; [OAuth2Authentication]<br \/>\n    permission_classes &#061; [TokenHasReadWriteScope]<br \/>\n    required_scopes &#061; [&#034;documents&#034;]<\/p>\n<p>    def get(self, request):<br \/>\n        return Response({&#034;ok&#034;: True})<\/p>\n<p>\u6743\u9650\u8bed\u4e49\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>TokenHasReadWriteScope \u4f1a\u6839\u636e HTTP \u65b9\u6cd5\u81ea\u52a8\u8981\u6c42\u5df2\u914d\u7f6e\u7684 read \u6216 write scope&#xff08;\u8bfb\u53d6\u7c7b\u65b9\u6cd5\u8981\u6c42 read&#xff0c;\u5199\u5165\u7c7b\u65b9\u6cd5\u8981\u6c42 write&#xff09;&#xff0c;\u540c\u65f6\u8fd8\u4f1a\u6821\u9a8c\u4f60\u5728\u89c6\u56fe\u4e0a\u58f0\u660e\u7684 required_scopes\u3002\u5b83\u9002\u5408&#034;\u8bfb\u64cd\u4f5c\/\u5199\u64cd\u4f5c&#034;\u8fd9\u7c7b\u8d44\u6e90\u7ea7\u6743\u9650\u6a21\u578b\u3002<\/li>\n<li>\u5f53\u4f60\u9700\u8981\u7cbe\u786e\u7684 scope \u5339\u914d\u3001\u4e0d\u5e0c\u671b\u5f15\u5165\u8bfb\/\u5199\u8bed\u4e49\u65f6&#xff0c;\u4f7f\u7528 TokenHasScope&#xff1a;\u5b83\u53ea\u68c0\u67e5\u4ee4\u724c\u662f\u5426\u5305\u542b\u89c6\u56fe\u58f0\u660e\u7684 scope\u3002<\/li>\n<\/ul>\n<p>\u4e24\u79cd\u6743\u9650\u7c7b\u90fd\u57fa\u4e8e\u4ee4\u724c\u4e2d\u643a\u5e26\u7684 scope \u96c6\u5408\u505a\u6821\u9a8c&#xff1a;\u4ee4\u724c\u7b7e\u53d1\u65f6\u58f0\u660e\u4e86\u4ec0\u4e48 scope&#xff0c;\u8bbf\u95ee API \u65f6\u5c31\u88ab\u5141\u8bb8\u8c03\u7528\u4ec0\u4e48\u8303\u56f4\u7684\u64cd\u4f5c\u3002<\/p>\n<h3>\u516b\u3001\u5e38\u7528\u8bbe\u7f6e\u8be6\u89e3&#xff08;Settings That Usually Matter&#xff09;<\/h3>\n<p>\u4ee5\u4e0b\u662f\u751f\u4ea7\u73af\u5883\u4e2d\u901a\u5e38\u9700\u8981\u5173\u6ce8\u7684 OAUTH2_PROVIDER \u8bbe\u7f6e\u9879&#xff1a;<\/p>\n<table>\n<tr>\u8bbe\u7f6e\u9879\u9ed8\u8ba4\u503c \/ \u5efa\u8bae\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>SCOPES<\/td>\n<td>\u5fc5\u914d<\/td>\n<td>\u5b9a\u4e49\u4f60\u7684\u4ee4\u724c\u53ef\u80fd\u8bf7\u6c42\u7684\u6bcf\u4e00\u4e2a scope&#xff0c;\u672a\u5728\u6b64\u58f0\u660e\u7684 scope \u4e0d\u4f1a\u88ab\u7b7e\u53d1<\/td>\n<\/tr>\n<tr>\n<td>DEFAULT_SCOPES<\/td>\n<td>__all__<\/td>\n<td>\u82e5\u4e0d\u60f3\u9ed8\u8ba4\u6388\u4e88\u5168\u90e8 scope&#xff0c;\u8bf7\u663e\u5f0f\u6536\u7a84\u9ed8\u8ba4\u503c<\/td>\n<\/tr>\n<tr>\n<td>PKCE_REQUIRED<\/td>\n<td>True<\/td>\n<td>\u9ed8\u8ba4\u5f00\u542f&#xff0c;\u4fdd\u6301\u5f00\u542f&#xff1b;\u4ec5\u5f53\u4f60\u6709\u65e0\u6cd5\u652f\u6301 PKCE \u7684\u53d7\u63a7\u9057\u7559\u5ba2\u6237\u7aef\u65f6\u624d\u8003\u8651\u5173\u95ed<\/td>\n<\/tr>\n<tr>\n<td>ALLOWED_REDIRECT_URI_SCHEMES<\/td>\n<td>\u9ed8\u8ba4\u5305\u542b http\/https \u7b49<\/td>\n<td>\u751f\u4ea7\u73af\u5883\u8bbe\u7f6e\u4e3a [&#034;https&#034;]&#xff1b;\u539f\u751f\u5e94\u7528\u7684\u56de\u73af&#xff08;loopback&#xff09;http \u91cd\u5b9a\u5411\u53ef\u63a5\u53d7<\/td>\n<\/tr>\n<tr>\n<td>REFRESH_TOKEN_REUSE_PROTECTION<\/td>\n<td>\u5173\u95ed<\/td>\n<td>\u914d\u5408\u8f6e\u6362\u7684\u5237\u65b0\u4ee4\u724c\u4f7f\u7528&#xff0c;\u68c0\u6d4b\u5230\u91cd\u7528\u5373\u64a4\u9500\u76f8\u5173\u4f1a\u8bdd<\/td>\n<\/tr>\n<tr>\n<td>REFRESH_TOKEN_EXPIRE_SECONDS<\/td>\n<td>\u89c1\u5b98\u65b9\u9ed8\u8ba4<\/td>\n<td>\u63a7\u5236\u6e05\u7406\u8d44\u683c&#xff0c;\u5176\u672c\u8eab\u5e76\u4e0d\u4f1a\u8ba9\u5237\u65b0\u4ee4\u724c\u5728\u6821\u9a8c\u65f6\u8fc7\u671f<\/td>\n<\/tr>\n<tr>\n<td>CLEAR_EXPIRED_TOKENS_BATCH_SIZE<\/td>\n<td>\u2014<\/td>\n<td>\u8c03\u6574\u5927\u6279\u91cf\u8fc7\u671f\u4ee4\u724c\u6e05\u7406\u4f5c\u4e1a\u7684\u6279\u6b21\u5927\u5c0f<\/td>\n<\/tr>\n<tr>\n<td>CLEAR_EXPIRED_TOKENS_BATCH_INTERVAL<\/td>\n<td>\u2014<\/td>\n<td>\u8c03\u6574\u6e05\u7406\u6279\u6b21\u95f4\u7684\u6267\u884c\u95f4\u9694<\/td>\n<\/tr>\n<tr>\n<td>ALLOW_URI_WILDCARDS<\/td>\n<td>False&#xff08;3.1.0 \u65b0\u589e&#xff09;<\/td>\n<td>\u5141\u8bb8\u91cd\u5b9a\u5411\/origin \u901a\u914d\u7b26&#xff1b;\u751f\u4ea7\u73af\u5883\u907f\u514d\u5f00\u542f&#xff0c;\u9664\u975e\u4f60\u5b8c\u5168\u7406\u89e3\u91cd\u5b9a\u5411-origin \u98ce\u9669<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u4e2d\u4e24\u4e2a\u6700\u5bb9\u6613\u8bef\u89e3\u7684\u8bbe\u7f6e\u9700\u8981\u91cd\u70b9\u89e3\u91ca&#xff1a;<\/p>\n<li>\n<p>REFRESH_TOKEN_EXPIRE_SECONDS \u4e0d\u7b49\u4e8e\u5237\u65b0\u4ee4\u724c\u81ea\u52a8\u8fc7\u671f\u6821\u9a8c\u3002\u5b98\u65b9\u6587\u6863\u660e\u786e\u6307\u51fa&#xff1a;\u8be5\u53c2\u6570\u53ea\u63a7\u5236\u8fc7\u671f\u5237\u65b0\u4ee4\u724c\u88ab cleartokens \u6e05\u7406\u7684\u8d44\u683c\u5224\u5b9a&#xff0c;\u5237\u65b0\u4ee4\u724c\u672c\u8eab\u7684\u6821\u9a8c\u5e76\u4e0d\u4f1a\u56e0\u6b64\u81ea\u52a8\u8fc7\u671f\u3002\u8fd9\u610f\u5473\u7740\u5982\u679c\u4f60\u7b7e\u53d1\u4e86\u5237\u65b0\u4ee4\u724c&#xff0c;\u5fc5\u987b\u5b9a\u671f\u6267\u884c\u6e05\u7406&#xff0c;\u5426\u5219\u8fc7\u671f\u5237\u65b0\u4ee4\u724c\u4f1a\u5728\u6570\u636e\u5e93\u4e2d\u957f\u671f\u7d2f\u79ef\u3002<\/p>\n<\/li>\n<li>\n<p>ALLOW_URI_WILDCARDS \u662f\u5b89\u5168\u654f\u611f\u7684\u9003\u751f\u8231\u3002\u5b83\u5141\u8bb8\u91cd\u5b9a\u5411 URI \u4e0e allowed origins \u4e2d\u7684\u901a\u914d\u7b26\u5339\u914d&#xff0c;\u4f46\u4e5f\u53ef\u80fd\u6269\u5927\u91cd\u5b9a\u5411\u653b\u51fb\u9762&#xff0c;\u5e94\u5f53\u53ea\u4f5c\u4e3a\u53d7\u63a7\u9884\u89c8\u73af\u5883\u4e0b\u7684\u6700\u540e\u624b\u6bb5\u3002<\/p>\n<\/li>\n<h4>\u914d\u5957\u7684\u6e05\u7406\u547d\u4ee4&#xff1a;cleartokens<\/h4>\n<p>DOT \u63d0\u4f9b cleartokens \u7ba1\u7406\u547d\u4ee4\u7528\u4e8e\u6e05\u7406\u8fc7\u671f\u4ee4\u724c&#xff1a;<\/p>\n<p>python manage.py cleartokens<\/p>\n<p>\u5982\u679c\u4f60\u7b7e\u53d1\u4e86\u5237\u65b0\u4ee4\u724c&#xff0c;\u5e94\u5f53\u901a\u8fc7 cron \/ Celery beat \u7b49\u65b9\u5f0f\u5b9a\u671f\u8c03\u5ea6\u8be5\u547d\u4ee4\u3002\u4e0d\u89c4\u5f8b\u6e05\u7406\u7684\u540e\u679c\u662f\u8fc7\u671f\u5237\u65b0\u4ee4\u724c\u5728\u6570\u636e\u5e93\u4e2d\u7684\u6301\u7eed\u7d2f\u79ef\u3002\u518d\u6b21\u5f3a\u8c03&#xff1a;REFRESH_TOKEN_EXPIRE_SECONDS \u5355\u72ec\u4f7f\u7528\u5e76\u4e0d\u4f1a\u8ba9\u5237\u65b0\u4ee4\u724c\u6821\u9a8c\u81ea\u884c\u8fc7\u671f\u3002<\/p>\n<h3>\u4e5d\u3001OpenID Connect \u8bbe\u7f6e<\/h3>\n<p>OIDC \u662f\u53ef\u9009\u80fd\u529b&#xff0c;\u9ed8\u8ba4\u5173\u95ed\u3002\u5f00\u542f\u540e&#xff0c;DOT \u53ef\u4ee5\u5728 OAuth 2.0 \u57fa\u7840\u4e0a\u7b7e\u53d1 ID Token&#xff08;JWT&#xff09;&#xff0c;\u7528\u4e8e\u8eab\u4efd\u8ba4\u8bc1&#xff08;Authentication&#xff09;\u573a\u666f\u3002\u7b7e\u540d\u7b97\u6cd5\u4f18\u5148\u9009\u62e9 RS256&#xff08;\u975e\u5bf9\u79f0&#xff09;\u3002<\/p>\n<h4>\u751f\u6210 RSA \u79c1\u94a5<\/h4>\n<p>openssl genrsa -out oidc.key 4096<\/p>\n<h4>\u542f\u7528 OIDC \u5e76\u914d\u7f6e\u5bc6\u94a5<\/h4>\n<p># settings.py<br \/>\nimport os<\/p>\n<p>OAUTH2_PROVIDER &#061; {<br \/>\n    &#034;OIDC_ENABLED&#034;: True,<br \/>\n    &#034;OIDC_RSA_PRIVATE_KEY&#034;: os.environ[&#034;OIDC_RSA_PRIVATE_KEY&#034;],<br \/>\n    &#034;SCOPES&#034;: {<br \/>\n        &#034;openid&#034;: &#034;OpenID Connect scope&#034;,<br \/>\n        &#034;profile&#034;: &#034;Profile access&#034;,<br \/>\n        &#034;email&#034;: &#034;Email access&#034;,<br \/>\n    },<br \/>\n}<\/p>\n<p>\u6ce8\u610f&#xff1a;OIDC \u9700\u8981 openid scope \u51fa\u73b0\u5728 SCOPES \u4e2d&#xff0c;\u5ba2\u6237\u7aef\u8bf7\u6c42\u65f6\u4e5f\u5fc5\u987b\u643a\u5e26 openid scope \u624d\u4f1a\u7b7e\u53d1 ID Token\u3002\u5bc6\u94a5\u5efa\u8bae\u4ece\u73af\u5883\u53d8\u91cf\u8bfb\u53d6&#xff0c;\u800c\u4e0d\u662f\u786c\u7f16\u7801\u8fdb\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<h4>\u91cd\u8981\u7684 OIDC \u7ea6\u675f<\/h4>\n<ul>\n<li>\u79c1\u94a5\u4e0d\u8981\u8fdb\u5165\u7248\u672c\u63a7\u5236&#xff1a;OIDC_RSA_PRIVATE_KEY \u5e94\u6765\u81ea\u5b89\u5168\u7684\u5bc6\u94a5\u7ba1\u7406\u7cfb\u7edf\u6216\u73af\u5883\u53d8\u91cf\u3002<\/li>\n<li>\u81ea\u5b9a\u4e49 server class \u7684\u7ee7\u627f\u7ea6\u675f&#xff1a;\u5982\u679c\u4f60\u5df2\u7ecf\u81ea\u5b9a\u4e49\u4e86 OAUTH2_SERVER_CLASS&#xff0c;\u90a3\u4e48\u542f\u7528 OIDC \u65f6&#xff0c;\u8be5\u7c7b\u5fc5\u987b\u6d3e\u751f\u81ea oauthlib.openid.Server&#xff0c;\u5426\u5219 OIDC \u80fd\u529b\u4e0d\u751f\u6548\u3002<\/li>\n<li>HS256 \u7684\u5c40\u9650&#xff1a;HS256 \u4f7f\u7528\u5e94\u7528\u5ba2\u6237\u7aef\u5bc6\u94a5\u8fdb\u884c\u7b7e\u540d&#xff0c;\u5b9e\u73b0\u66f4\u7b80\u5355&#xff0c;\u4f46\u7075\u6d3b\u6027\u5dee&#xff0c;\u4e14\u4e0d\u9002\u7528\u4e8e\u516c\u5f00\u5ba2\u6237\u7aef&#xff08;Public clients&#xff09;\u4ee5\u53ca implicit\/hybrid \u6d41\u7a0b\u3002\u56e0\u6b64\u4f18\u5148\u4f7f\u7528 RS256\u3002<\/li>\n<li>\u5bc6\u94a5\u8f6e\u6362&#xff1a;\u8fdb\u884c RSA \u5bc6\u94a5\u8f6e\u6362\u65f6&#xff0c;\u4f7f\u7528 OIDC_RSA_PRIVATE_KEYS_INACTIVE \u914d\u7f6e&#034;\u975e\u6d3b\u8dc3\u65e7\u5bc6\u94a5&#034;\u5217\u8868\u6765\u652f\u6301\u65e7\u5bc6\u94a5\u7684\u5e73\u6ed1\u8fc7\u6e21&#xff0c;\u800c\u4e0d\u662f\u7a81\u7136\u66ff\u6362 OIDC_RSA_PRIVATE_KEY&#xff0c;\u907f\u514d\u5df2\u7b7e\u53d1\u7684 ID Token \u77ac\u95f4\u5168\u90e8\u5931\u6548\u3002<\/li>\n<\/ul>\n<h3>\u5341\u3001\u5206\u79bb\u8d44\u6e90\u670d\u52a1\u5668\u6a21\u5f0f&#xff08;Separate Resource Server Pattern&#xff09;<\/h3>\n<p>\u5f53\u4f60\u7684 API \u670d\u52a1\u4e0e\u6388\u6743\u670d\u52a1\u5668\u662f\u4e24\u4e2a\u72ec\u7acb\u90e8\u7f72\u7684\u670d\u52a1\u65f6&#xff0c;DOT \u652f\u6301\u4ee4\u724c introspection&#xff08;\u5185\u7701&#xff09;\u673a\u5236&#xff0c;\u8ba9\u8d44\u6e90\u670d\u52a1\u5668\u65e0\u9700\u5171\u4eab\u6570\u636e\u5e93\u5373\u53ef\u6821\u9a8c\u4ee4\u724c\u3002<\/p>\n<h4>\u6388\u6743\u670d\u52a1\u5668\u4fa7<\/h4>\n<ul>\n<li>\u5305\u542b introspection \u7aef\u70b9&#xff1a;\u6302\u8f7d\u5728 \/o\/introspect\/ \u4e0b&#xff08;DOT \u8def\u7531\u9ed8\u8ba4\u5df2\u63d0\u4f9b&#xff09;&#xff1b;<\/li>\n<li>\u6dfb\u52a0\u4e00\u4e2a introspection scope&#xff1b;<\/li>\n<li>\u4e3a\u8d44\u6e90\u670d\u52a1\u5668\u7b7e\u53d1\u4e00\u4e2a\u53ef\u7528\u4e8e introspection \u7684\u4e13\u7528\u4ee4\u724c&#xff08;\u901a\u5e38\u662f confidential \u5ba2\u6237\u7aef\u4ee4\u724c&#xff09;\u3002<\/li>\n<\/ul>\n<h4>\u8d44\u6e90\u670d\u52a1\u5668\u4fa7<\/h4>\n<p>\u5728\u8d44\u6e90\u670d\u52a1\u5668\u7684 OAUTH2_PROVIDER \u4e2d\u914d\u7f6e&#xff1a;<\/p>\n<ul>\n<li>RESOURCE_SERVER_INTROSPECTION_URL&#xff1a;\u6307\u5411\u6388\u6743\u670d\u52a1\u5668\u7684 introspection \u7aef\u70b9&#xff1b;<\/li>\n<li>\u4e8c\u9009\u4e00\u8bbe\u7f6e\u51ed\u8bc1&#xff1a;\n<ul>\n<li>RESOURCE_SERVER_AUTH_TOKEN&#xff1a;\u56fa\u5b9a Bearer \u4ee4\u724c&#xff1b;\u6216<\/li>\n<li>RESOURCE_SERVER_INTROSPECTION_CREDENTIALS&#xff1a;client_id \u4e0e client_secret \u51ed\u8bc1\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u4f55\u65f6\u4f7f\u7528<\/h4>\n<p>\u4ec5\u5f53\u4f60\u786e\u5b9e\u62c6\u5206\u90e8\u7f72\u4e86\u6388\u6743\u670d\u52a1\u5668\u4e0e\u8d44\u6e90\u670d\u52a1\u5668\u65f6\u624d\u4f7f\u7528 introspection\u3002\u5bf9\u4e8e\u5355\u4e2a Django \u5e94\u7528&#xff08;\u6388\u6743\u4e0e\u8d44\u6e90\u540c\u4f53&#xff09;&#xff0c;\u4f7f\u7528\u6807\u51c6\u7684\u672c\u5730\u4ee4\u724c\u6821\u9a8c&#xff08;\u5373\u524d\u4e00\u8282\u7684 DRF OAuth2Authentication \u76f4\u63a5\u6821\u9a8c\u7b7e\u540d\/\u6570\u636e\u5e93\u4e2d\u7684\u4ee4\u724c&#xff09;\u66f4\u52a0\u7b80\u5355\u3001\u5f00\u9500\u66f4\u4f4e\u3001\u4e5f\u66f4\u53ef\u9760\u3002introspection \u6a21\u5f0f\u5f15\u5165\u4e86\u989d\u5916\u7684\u7f51\u7edc\u5f80\u8fd4\u4e0e\u4f9d\u8d56&#xff0c;\u4e0d\u5e94\u88ab\u5f53\u4f5c\u9ed8\u8ba4\u65b9\u6848\u3002<\/p>\n<h3>\u5341\u4e00\u3001\u5e38\u89c1\u9677\u9631&#xff08;Common Pitfalls&#xff09;<\/h3>\n<p>\u7ed3\u5408 DOT 3.2.0 \u7684\u5b98\u65b9\u8bf4\u660e&#xff0c;\u4ee5\u4e0b\u662f\u6700\u5bb9\u6613\u8e29\u5751\u7684\u70b9&#xff1a;<\/p>\n<li>\u5b9a\u4f4d\u9519\u8bef&#xff1a;DOT \u662f\u6388\u6743\u670d\u52a1\u5668\u5de5\u5177\u5305&#xff0c;\u4e0d\u662f\u7b2c\u4e09\u65b9 OAuth \u5ba2\u6237\u7aef\u6216\u793e\u4ea4\u767b\u5f55\u5305\u3002\u9700\u6c42\u9009\u578b\u65f6\u5148\u5206\u6e05\u4f60\u662f&#034;\u53d1\u4ee4\u724c\u7684\u4e00\u65b9&#034;\u8fd8\u662f&#034;\u6d88\u8d39\u522b\u4eba\u4ee4\u724c\u7684\u4e00\u65b9&#034;\u3002<\/li>\n<li>\u4f9d\u8d56\u8fc7\u65f6\u6559\u7a0b&#xff1a;\u8f83\u8001\u7684\u535a\u5ba2\u6587\u7ae0\u5e38\u5c55\u793a\u8fc7\u65f6\u7684\u914d\u7f6e\u65b9\u5f0f\u3002\u8bf7\u4ee5\u5f53\u524d 3.2.0 \u7684\u5b98\u65b9\u6587\u6863\u4e3a\u51c6\u6765\u914d\u7f6e URL \u6302\u8f7d&#xff08;\/o\/ \u524d\u7f00&#xff09;\u4e0e\u8bbe\u7f6e\u9879\u540d\u79f0\u3002<\/li>\n<li>\u516c\u5f00\u5ba2\u6237\u7aef\u9057\u6f0f PKCE \u53c2\u6570&#xff1a;\u516c\u5f00\u5ba2\u6237\u7aef\u5982\u679c\u6f0f\u4f20 code_challenge \/ code_verifier&#xff0c;\u6388\u6743\u7801\u4ea4\u6362\u4f1a\u76f4\u63a5\u5931\u8d25&#xff0c;\u56e0\u4e3a PKCE_REQUIRED \u9ed8\u8ba4\u5f00\u542f\u3002<\/li>\n<li>\u660e\u6587\u5bc6\u94a5\u4e0d\u53ef\u6062\u590d&#xff1a;\u5f00\u542f\u54c8\u5e0c\u540e&#xff0c;\u5ba2\u6237\u7aef\u660e\u6587 secret \u5728\u4fdd\u5b58\u540e\u65e0\u6cd5\u4ece admin \u6062\u590d\u3002\u521b\u5efa confidential \u5ba2\u6237\u7aef\u65f6\u52a1\u5fc5\u5f53\u573a\u590d\u5236\u3002<\/li>\n<li>\u5237\u65b0\u4ee4\u724c\u6e05\u7406\u8bef\u89e3&#xff1a;REFRESH_TOKEN_EXPIRE_SECONDS \u4e0d\u4f1a\u5728\u6821\u9a8c\u65f6\u81ea\u52a8\u4f7f\u5237\u65b0\u4ee4\u724c\u5931\u6548&#xff0c;\u5b83\u4e3b\u8981\u9a71\u52a8 cleartokens \u6e05\u7406&#xff1b;\u9664\u975e\u4f60\u81ea\u5b9a\u4e49\u6821\u9a8c\u903b\u8f91&#xff0c;\u5426\u5219\u8fc7\u671f\u5237\u65b0\u4ee4\u724c\u4f9d\u7136\u53ef\u80fd\u88ab\u7528\u4e8e\u6362\u53d6\u65b0\u4ee4\u724c&#xff0c;\u5fc5\u987b\u914d\u5408\u8f6e\u6362\u4e0e\u91cd\u7528\u4fdd\u62a4\u3002<\/li>\n<li>\u901a\u914d\u7b26\u9003\u751f\u8231&#xff1a;ALLOW_URI_WILDCARDS \u662f\u5b89\u5168\u654f\u611f\u914d\u7f6e&#xff0c;\u5e94\u4f5c\u4e3a\u53d7\u63a7\u9884\u89c8\u73af\u5883\u7684\u6700\u540e\u624b\u6bb5&#xff0c;\u751f\u4ea7\u73af\u5883\u9ed8\u8ba4\u4fdd\u6301\u5173\u95ed\u3002<\/li>\n<li>3.0.0 \u5347\u7ea7\u7684\u9690\u85cf\u6210\u672c&#xff1a;\u4ece 3.0.0 \u4e4b\u524d\u7684\u7248\u672c\u5347\u7ea7\u65f6&#xff0c;\u82e5\u4f60\u4f7f\u7528\u4e86\u53ef\u66ff\u6362\u7684 DOT \u6a21\u578b&#xff08;swappable models&#xff09;&#xff0c;\u6216\u4ee3\u7801\u5047\u8bbe\u4ee4\u724c\u6a21\u578b\u4e3b\u952e\u540d\u4e3a id&#xff0c;\u9700\u8981\u683c\u5916\u5c0f\u5fc3\u8fc1\u79fb\u3002<\/li>\n<h3>\u5341\u4e8c\u3001\u7248\u672c\u654f\u611f\u4fe1\u606f&#xff08;Version-Sensitive Notes&#xff09;<\/h3>\n<ul>\n<li>3.2.0&#xff1a;\u65b0\u589e**\u8bbe\u5907\u6388\u6743\u6388\u6743\u7c7b\u578b&#xff08;device authorization grant&#xff09;**\u652f\u6301&#xff1b;\u65b0\u589e\u5bf9 Django 5.2 \u4e0e Python 3.14 \u7684\u652f\u6301\u3002<\/li>\n<li>3.1.0&#xff1a;\u901a\u8fc7 ALLOW_URI_WILDCARDS \u65b0\u589e\u91cd\u5b9a\u5411\/origin \u901a\u914d\u7b26\u652f\u6301&#xff1b;\u4fee\u590d\u4e86\u82e5\u5e72\u8fc1\u79fb\u4e0e introspection \u95ee\u9898\u3002<\/li>\n<li>3.0.1&#xff1a;\u4fee\u590d\u4e86\u6570\u636e\u5e93\u4e2d\u5df2\u5b58\u5728\u5b58\u91cf\u8bbf\u95ee\u4ee4\u724c\u65f6\u7684\u8fc1\u79fb\u9519\u8bef\u3002<\/li>\n<li>3.0.0&#xff08;\u91cd\u8981\u7684\u7834\u574f\u6027\u5206\u754c\u7ebf&#xff09;&#xff1a;\n<ul>\n<li>\u5347\u7ea7\u540e\u5fc5\u987b\u6267\u884c python manage.py migrate&#xff1b;<\/li>\n<li>\u66f4\u65b0\u81ea\u5b9a\u4e49\u7684 swappable \u6a21\u578b\u5e76&#xff08;\u5982\u6709\u9700\u8981&#xff09;\u751f\u6210\u5bf9\u5e94\u8fc1\u79fb&#xff1b;<\/li>\n<li>Django \u4f4e\u4e8e 4.2 \u7684\u7248\u672c\u4e0d\u518d\u53d7\u652f\u6301&#xff1b;<\/li>\n<li>\u8bbf\u95ee\u4ee4\u724c\u5b58\u50a8\u6539\u4e3a TextField &#043; token_checksum&#xff08;\u4ee4\u724c\u539f\u6587\u4e0d\u518d\u76f4\u63a5\u53ef\u67e5&#xff0c;\u6539\u4e3a\u6821\u9a8c\u548c\u6bd4\u5bf9&#xff09;&#xff1b;<\/li>\n<li>\u5f15\u5165 REFRESH_TOKEN_REUSE_PROTECTION \u4f5c\u4e3a\u5b89\u5168\u63a7\u5236&#xff1b;<\/li>\n<li>\u6700\u4f4e oauthlib \u7248\u672c\u8981\u6c42\u4e3a 3.2.2&#043;\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u5341\u4e09\u3001\u5728 Context Hub \u4e2d\u83b7\u53d6\u4e0e\u7ef4\u62a4\u672c\u6587\u6863<\/h3>\n<p>\u8fd9\u4efd\u6307\u5357\u5728\u4ed3\u5e93\u4e2d\u7684\u4f4d\u7f6e\u662f content\/django\/docs\/oauth-toolkit\/python\/DOC.md&#xff0c;\u5c5e\u4e8e Context Hub \u7684 django \u4f5c\u8005\u76ee\u5f55\u4e0b oauth-toolkit \u6761\u76ee\u7684 Python \u8bed\u8a00\u53d8\u4f53\u3002\u6309\u7167 docs\/content-guide.md \u7684\u7ea6\u5b9a&#xff0c;DOC.md \u4f7f\u7528 YAML frontmatter \u58f0\u660e name\u3001description\u3001metadata.languages\u3001metadata.versions\u3001metadata.revision\u3001metadata.updated-on\u3001metadata.source \u7b49\u5b57\u6bb5&#xff0c;\u5176\u4e2d source: maintainer \u8868\u793a\u8be5\u6761\u76ee\u7531 Context Hub \u7ef4\u62a4\u56e2\u961f\u7f16\u5199&#xff0c;\u5c5e\u4e8e\u53ef\u4fe1\u6765\u6e90&#xff1b;versions: &#034;3.2.0&#034; \u4e0e PyPI \u4e0a\u7684\u5305\u7248\u672c\u5bf9\u9f50&#xff0c;\u4fbf\u4e8e Agent \u4ece requirements.txt \u63a2\u6d4b\u5230\u4f9d\u8d56\u7248\u672c\u540e\u7cbe\u786e\u5339\u914d\u6587\u6863\u3002<\/p>\n<p>\u5982\u679c\u4f60\u7684 Coding Agent \u9700\u8981\u7f16\u5199\u6216\u6821\u9a8c\u4f7f\u7528 django-oauth-toolkit \u7684\u4ee3\u7801&#xff0c;\u53ef\u4ee5\u6309 cli\/skills\/get-api-docs\/SKILL.md \u7684\u6d41\u7a0b&#xff0c;\u5148\u8fd0\u884c chub &#8211;help \u83b7\u53d6\u6700\u65b0\u6307\u4ee4&#xff0c;\u518d\u7528 chub search &#034;django oauth toolkit&#034; \u627e\u5230\u6761\u76ee&#xff0c;\u6700\u540e chub get django\/oauth-toolkit &#8211;lang py \u62c9\u53d6\u672c\u6587\u6863\u5185\u5bb9&#xff1b;\u82e5\u5728\u5b9e\u6218\u4e2d\u53d1\u73b0\u6587\u6863\u672a\u8986\u76d6\u7684\u5751&#xff08;\u4f8b\u5982\u67d0\u4e2a grant type \u7684\u8fb9\u754c\u884c\u4e3a&#xff09;&#xff0c;\u8fd8\u53ef\u4ee5\u7528 chub annotate \u8bb0\u5f55\u672c\u5730\u7b14\u8bb0&#xff0c;\u5e76\u7528 chub feedback \u53cd\u9988\u7ed9\u7ef4\u62a4\u8005&#xff0c;\u63a8\u52a8\u6587\u6863\u6301\u7eed\u6539\u8fdb&#xff08;\u8be6\u89c1 docs\/feedback-and-annotations.md \u4e0e docs\/features\/agent-annotations.md&#xff09;\u3002<\/p>\n<p>\u9700\u8981\u8bf4\u660e\u7684\u662f&#xff1a;\u672c\u6587\u5bf9\u517c\u5bb9\u6027\u3001\u9ed8\u8ba4\u503c\u7b49\u7ec6\u8282\u7684\u8868\u8ff0\u5747\u4ee5 DOT 3.2.0 \u5b98\u65b9\u6587\u6863\u5feb\u7167\u4e3a\u51c6&#xff08;\u672c\u4ed3\u5e93\u8be5\u6761\u76ee\u5373\u5176\u5fe0\u5b9e\u6574\u7406\u7248&#xff09;&#xff1b;\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528\u7684\u7248\u672c\u4e0d\u540c&#xff08;\u5982\u4ecd\u5728 2.x&#xff09;&#xff0c;\u8bf7\u4ee5\u5bf9\u5e94\u7248\u672c\u6587\u6863\u548c changelog \u4e3a\u51c6&#xff0c;\u5c24\u5176\u5173\u6ce8 3.0.0 \u7684\u7834\u574f\u6027\u53d8\u66f4\u6e05\u5355\u3002<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261022050054-6ad998866b3a4.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011context-hub<\/h3>\n<p class=\"gcb-project-desc\">\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/gh_mirrors\/co\/context-hub<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\"> Django-OAuth-Toolkit \u7684 OpenID Connect \u96c6\u6210\u6307\u5357<\/h5>\n<p class=\"gcb-related-item-desc\">Django OAuth Toolkit \u7684 OpenID Connect \u96c6\u6210\u6307\u5357 \u4ec0\u4e48\u662f OpenID Connect OpenID Connect&#xff08;\u7b80\u79f0 <\/p>\n<\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\"> Django-OAuth-Toolkit\u4e2d\u7684OpenID Connect\u96c6\u6210\u6307\u5357<\/h5>\n<p class=\"gcb-related-item-desc\">Django OAuth Toolkit\u4e2d\u7684OpenID Connect\u96c6\u6210\u6307\u5357 \u4ec0\u4e48\u662fOpenID Connect OpenID Connect&#xff08;\u7b80\u79f0OIDC<\/p>\n<\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\"> Django OAuth Toolkit \u5165\u95e8\u6559\u7a0b&#xff1a;\u5feb\u901f\u642d\u5efaOAuth2\u6388\u6743\u670d\u52a1\u5668<\/h5>\n<p class=\"gcb-related-item-desc\">Django OAuth Toolkit \u5165\u95e8\u6559\u7a0b&#xff1a;\u5feb\u901f\u642d\u5efaOAuth2\u6388\u6743\u670d\u52a1\u5668 \u4e3a\u4ec0\u4e48\u9700\u8981OAuth2\u6388\u6743\u670d\u52a1\u5668&#xff1f; \u5728\u73b0\u4ee3Web\u5e94\u7528\u5f00\u53d1\u4e2d&#xff0c;API\u5b89\u5168\u662f\u81f3\u5173<\/p>\n<\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  Kubernetes\u670d\u52a1\u5b89\u5168\u66b4\u9732\u5b9e\u6218&#xff1a;Cloudflare Tunnel\u63a7\u5236\u5668\u5b8c\u6574\u6307\u5357 <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  Mongoose OS I2C\u901a\u4fe1\u5b9e\u6218&#xff1a;\u4f20\u611f\u5668\u6570\u636e\u91c7\u96c6\u4e0e\u5904\u7406 <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011context-hub \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/co\/context-hub \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d  \u672c\u7bc7\u6307\u5357\u4ee5 Context Hub \u7ef4\u62a4\u7684 django-oauth-toolkit \u6587\u6863 \u4e3a\u9aa8\u67b6&#xff0c;\u7cfb\u7edf\u8bb2\u89e3\u5982\u4f55\u628a\u4e00\u4e2a Django \u9879\u76ee\u6539\u9020\u6210 OAuth 2.0 \u6388\u6743\u670d\u52a1\u5668&#xff08;Authorization Server&#xff09;&#xff1a;\u8986\u76d6\u6700\u5c0f\u5316\u914d\u7f6e\u3001\u5ba2\u6237\u7aef<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-117055","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/117055.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011context-hub \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/co\/context-hub \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u672c\u7bc7\u6307\u5357\u4ee5 Context Hub \u7ef4\u62a4\u7684 django-oauth-toolkit \u6587\u6863 \u4e3a\u9aa8\u67b6&#xff0c;\u7cfb\u7edf\u8bb2\u89e3\u5982\u4f55\u628a\u4e00\u4e2a Django \u9879\u76ee\u6539\u9020\u6210 OAuth 2.0 \u6388\u6743\u670d\u52a1\u5668&#xff08;Authorization Server&#xff09;&#xff1a;\u8986\u76d6\u6700\u5c0f\u5316\u914d\u7f6e\u3001\u5ba2\u6237\u7aef\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/117055.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-22T05:00:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261022050054-6ad998866b3a4.svg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117055.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/117055.html\",\"name\":\"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-22T05:00:55+00:00\",\"dateModified\":\"2026-10-22T05:00:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/117055.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/117055.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117055.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/117055.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011context-hub \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/gh_mirrors\/co\/context-hub \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u672c\u7bc7\u6307\u5357\u4ee5 Context Hub \u7ef4\u62a4\u7684 django-oauth-toolkit \u6587\u6863 \u4e3a\u9aa8\u67b6&#xff0c;\u7cfb\u7edf\u8bb2\u89e3\u5982\u4f55\u628a\u4e00\u4e2a Django \u9879\u76ee\u6539\u9020\u6210 OAuth 2.0 \u6388\u6743\u670d\u52a1\u5668&#xff08;Authorization Server&#xff09;&#xff1a;\u8986\u76d6\u6700\u5c0f\u5316\u914d\u7f6e\u3001\u5ba2\u6237\u7aef","og_url":"https:\/\/www.wsisp.com\/helps\/117055.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-22T05:00:55+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261022050054-6ad998866b3a4.svg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/117055.html","url":"https:\/\/www.wsisp.com\/helps\/117055.html","name":"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-22T05:00:55+00:00","dateModified":"2026-10-22T05:00:55+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/117055.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/117055.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/117055.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528 django-oauth-toolkit 3.2.0 \u6784\u5efa Django OAuth2 \u4e0e OpenID Connect \u6388\u6743\u670d\u52a1\u5668\uff1a\u4ece\u6700\u5c0f\u914d\u7f6e\u5230 DRF \u96c6\u6210\u5b9e\u6218\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/117055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=117055"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/117055\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=117055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=117055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=117055"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=117055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}