{"id":15420,"date":"2024-11-17T21:04:03","date_gmt":"2024-11-17T13:04:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/?p=15420"},"modified":"2024-11-17T21:04:03","modified_gmt":"2024-11-17T13:04:03","slug":"%e7%90%86%e8%a7%a3oauth-2-0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/15420\/","title":{"rendered":"\u7406\u89e3OAuth 2.0"},"content":{"rendered":"<p>OAuth\u662f\u4e00\u4e2a\u5173\u4e8e\u6388\u6743\uff08authorization\uff09\u7684\u5f00\u653e\u7f51\u7edc\u6807\u51c6\uff0c\u5728\u5168\u4e16\u754c\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\uff0c\u76ee\u524d\u7684\u7248\u672c\u662f2.0\u7248\u3002<br \/>\n\u672c\u6587\u5bf9OAuth 2.0\u7684\u8bbe\u8ba1\u601d\u8def\u548c\u8fd0\u884c\u6d41\u7a0b\uff0c\u505a\u4e00\u4e2a\u7b80\u660e\u901a\u4fd7\u7684\u89e3\u91ca\uff0c\u4e3b\u8981\u53c2\u8003\u6750\u6599\u4e3aRFC 6749\u3002<\/p>\n<h1>\u4e00\u3001\u5e94\u7528\u573a\u666f<\/h1>\n<p>\u4e3a\u4e86\u7406\u89e3OAuth\u7684\u9002\u7528\u573a\u5408\uff0c\u8ba9\u6211\u4e3e\u4e00\u4e2a\u5047\u8bbe\u7684\u4f8b\u5b50\u3002<\/p>\n<p>\u6709\u4e00\u4e2a\u201d\u4e91\u51b2\u5370\u201d\u7684\u7f51\u7ad9\uff0c\u53ef\u4ee5\u5c06\u7528\u6237\u50a8\u5b58\u5728Google\u7684\u7167\u7247\uff0c\u51b2\u5370\u51fa\u6765\u3002\u7528\u6237\u4e3a\u4e86\u4f7f\u7528\u8be5\u670d\u52a1\uff0c\u5fc5\u987b\u8ba9\u201d\u4e91\u51b2\u5370\u201d\u8bfb\u53d6\u81ea\u5df1\u50a8\u5b58\u5728Google\u4e0a\u7684\u7167\u7247\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u95ee\u9898\u662f\u53ea\u6709\u5f97\u5230\u7528\u6237\u7684\u6388\u6743\uff0cGoogle\u624d\u4f1a\u540c\u610f\u201d\u4e91\u51b2\u5370\u201d\u8bfb\u53d6\u8fd9\u4e9b\u7167\u7247\u3002\u90a3\u4e48\uff0c\u201d\u4e91\u51b2\u5370\u201d\u600e\u6837\u83b7\u5f97\u7528\u6237\u7684\u6388\u6743\u5462\uff1f<\/p>\n<p>\u4f20\u7edf\u65b9\u6cd5\u662f\uff0c\u7528\u6237\u5c06\u81ea\u5df1\u7684Google\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u544a\u8bc9\u201d\u4e91\u51b2\u5370\u201d\uff0c\u540e\u8005\u5c31\u53ef\u4ee5\u8bfb\u53d6\u7528\u6237\u7684\u7167\u7247\u4e86\u3002\u8fd9\u6837\u7684\u505a\u6cd5\u6709\u4ee5\u4e0b\u51e0\u4e2a\u4e25\u91cd\u7684\u7f3a\u70b9\u3002<\/p>\n<ol>\n<li>\u201c\u4e91\u51b2\u5370\u201d\u4e3a\u4e86\u540e\u7eed\u7684\u670d\u52a1\uff0c\u4f1a\u4fdd\u5b58\u7528\u6237\u7684\u5bc6\u7801\uff0c\u8fd9\u6837\u5f88\u4e0d\u5b89\u5168\u3002<\/li>\n<li>Google\u4e0d\u5f97\u4e0d\u90e8\u7f72\u5bc6\u7801\u767b\u5f55\uff0c\u800c\u6211\u4eec\u77e5\u9053\uff0c\u5355\u7eaf\u7684\u5bc6\u7801\u767b\u5f55\u5e76\u4e0d\u5b89\u5168\u3002<\/li>\n<li>\u201c\u4e91\u51b2\u5370\u201d\u62e5\u6709\u4e86\u83b7\u53d6\u7528\u6237\u50a8\u5b58\u5728Google\u6240\u6709\u8d44\u6599\u7684\u6743\u529b\uff0c\u7528\u6237\u6ca1\u6cd5\u9650\u5236\u201d\u4e91\u51b2\u5370\u201d\u83b7\u5f97\u6388\u6743\u7684\u8303\u56f4\u548c\u6709\u6548\u671f\u3002<\/li>\n<li>\u7528\u6237\u53ea\u6709\u4fee\u6539\u5bc6\u7801\uff0c\u624d\u80fd\u6536\u56de\u8d4b\u4e88\u201d\u4e91\u51b2\u5370\u201d\u7684\u6743\u529b\u3002\u4f46\u662f\u8fd9\u6837\u505a\uff0c\u4f1a\u4f7f\u5f97\u5176\u4ed6\u6240\u6709\u83b7\u5f97\u7528\u6237\u6388\u6743\u7684\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u5168\u90e8\u5931\u6548\u3002<\/li>\n<li>\u53ea\u8981\u6709\u4e00\u4e2a\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u88ab\u7834\u89e3\uff0c\u5c31\u4f1a\u5bfc\u81f4\u7528\u6237\u5bc6\u7801\u6cc4\u6f0f\uff0c\u4ee5\u53ca\u6240\u6709\u88ab\u5bc6\u7801\u4fdd\u62a4\u7684\u6570\u636e\u6cc4\u6f0f\u3002<\/li>\n<\/ol>\n<p>OAuth\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u4e0a\u9762\u8fd9\u4e9b\u95ee\u9898\u800c\u8bde\u751f\u7684\u3002<\/p>\n<h1>\u4e8c\u3001\u540d\u8bcd\u5b9a\u4e49<\/h1>\n<p>\u5728\u8be6\u7ec6\u8bb2\u89e3OAuth 2.0\u4e4b\u524d\uff0c\u9700\u8981\u4e86\u89e3\u51e0\u4e2a\u4e13\u7528\u540d\u8bcd\u3002\u5b83\u4eec\u5bf9\u8bfb\u61c2\u540e\u9762\u7684\u8bb2\u89e3\uff0c\u5c24\u5176\u662f\u51e0\u5f20\u56fe\uff0c\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<ol>\n<li>Third-party application\uff1a\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\uff0c\u672c\u6587\u4e2d\u53c8\u79f0\u201d\u5ba2\u6237\u7aef\u201d\uff08client\uff09\uff0c\u5373\u4e0a\u4e00\u8282\u4f8b\u5b50\u4e2d\u7684\u201d\u4e91\u51b2\u5370\u201d\u3002<\/li>\n<li>HTTP service\uff1aHTTP\u670d\u52a1\u63d0\u4f9b\u5546\uff0c\u672c\u6587\u4e2d\u7b80\u79f0\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\uff0c\u5373\u4e0a\u4e00\u8282\u4f8b\u5b50\u4e2d\u7684Google\u3002<\/li>\n<li>Resource Owner\uff1a\u8d44\u6e90\u6240\u6709\u8005\uff0c\u672c\u6587\u4e2d\u53c8\u79f0\u201d\u7528\u6237\u201d\uff08user\uff09\u3002<\/li>\n<li>User Agent\uff1a\u7528\u6237\u4ee3\u7406\uff0c\u672c\u6587\u4e2d\u5c31\u662f\u6307\u6d4f\u89c8\u5668\u3002<\/li>\n<li>Authorization server\uff1a\u8ba4\u8bc1\u670d\u52a1\u5668\uff0c\u5373\u670d\u52a1\u63d0\u4f9b\u5546\u4e13\u95e8\u7528\u6765\u5904\u7406\u8ba4\u8bc1\u7684\u670d\u52a1\u5668\u3002<\/li>\n<li>Resource server\uff1a\u8d44\u6e90\u670d\u52a1\u5668\uff0c\u5373\u670d\u52a1\u63d0\u4f9b\u5546\u5b58\u653e\u7528\u6237\u751f\u6210\u7684\u8d44\u6e90\u7684\u670d\u52a1\u5668\u3002\u5b83\u4e0e\u8ba4\u8bc1\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u662f\u540c\u4e00\u53f0\u670d\u52a1\u5668\uff0c\u4e5f\u53ef\u4ee5\u662f\u4e0d\u540c\u7684\u670d\u52a1\u5668\u3002<\/li>\n<\/ol>\n<p>\u77e5\u9053\u4e86\u4e0a\u9762\u8fd9\u4e9b\u540d\u8bcd\uff0c\u5c31\u4e0d\u96be\u7406\u89e3\uff0cOAuth\u7684\u4f5c\u7528\u5c31\u662f\u8ba9\u201d\u5ba2\u6237\u7aef\u201d\u5b89\u5168\u53ef\u63a7\u5730\u83b7\u53d6\u201d\u7528\u6237\u201d\u7684\u6388\u6743\uff0c\u4e0e\u201d\u670d\u52a1\u5546\u63d0\u4f9b\u5546\u201d\u8fdb\u884c\u4e92\u52a8\u3002<\/p>\n<h1>\u4e09\u3001OAuth\u7684\u601d\u8def<\/h1>\n<p>OAuth\u5728\u201d\u5ba2\u6237\u7aef\u201d\u4e0e\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\u4e4b\u95f4\uff0c\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u6388\u6743\u5c42\uff08authorization layer\uff09\u3002\u201d\u5ba2\u6237\u7aef\u201d\u4e0d\u80fd\u76f4\u63a5\u767b\u5f55\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\uff0c\u53ea\u80fd\u767b\u5f55\u6388\u6743\u5c42\uff0c\u4ee5\u6b64\u5c06\u7528\u6237\u4e0e\u5ba2\u6237\u7aef\u533a\u5206\u5f00\u6765\u3002\u201d\u5ba2\u6237\u7aef\u201d\u767b\u5f55\u6388\u6743\u5c42\u6240\u7528\u7684\u4ee4\u724c\uff08token\uff09\uff0c\u4e0e\u7528\u6237\u7684\u5bc6\u7801\u4e0d\u540c\u3002\u7528\u6237\u53ef\u4ee5\u5728\u767b\u5f55\u7684\u65f6\u5019\uff0c\u6307\u5b9a\u6388\u6743\u5c42\u4ee4\u724c\u7684\u6743\u9650\u8303\u56f4\u548c\u6709\u6548\u671f\u3002<\/p>\n<p>\u201c\u5ba2\u6237\u7aef\u201d\u767b\u5f55\u6388\u6743\u5c42\u4ee5\u540e\uff0c\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\u6839\u636e\u4ee4\u724c\u7684\u6743\u9650\u8303\u56f4\u548c\u6709\u6548\u671f\uff0c\u5411\u201d\u5ba2\u6237\u7aef\u201d\u5f00\u653e\u7528\u6237\u50a8\u5b58\u7684\u8d44\u6599\u3002<\/p>\n<h1>\u56db\u3001\u8fd0\u884c\u6d41\u7a0b<\/h1>\n<p>OAuth 2.0\u7684\u8fd0\u884c\u6d41\u7a0b\u5982\u4e0b\u56fe\uff0c\u6458\u81eaRFC 6749\u3002<\/p>\n<p><a href=\"http:\/\/fwq.ai\/wp-content\/uploads\/2017\/10\/bg2014051203.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-15424\" src=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051203.png\" width=\"766\" height=\"411\" srcset=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051203.png 766w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051203-300x161.png 300w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051203-670x359.png 670w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" title=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe\" alt=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe\" \/><\/a><\/p>\n<p>OAuth\u8fd0\u884c\u6d41\u7a0b<\/p>\n<ul>\n<li>\uff08A\uff09\u7528\u6237\u6253\u5f00\u5ba2\u6237\u7aef\u4ee5\u540e\uff0c\u5ba2\u6237\u7aef\u8981\u6c42\u7528\u6237\u7ed9\u4e88\u6388\u6743\u3002<\/li>\n<li>\uff08B\uff09\u7528\u6237\u540c\u610f\u7ed9\u4e88\u5ba2\u6237\u7aef\u6388\u6743\u3002<\/li>\n<li>\uff08C\uff09\u5ba2\u6237\u7aef\u4f7f\u7528\u4e0a\u4e00\u6b65\u83b7\u5f97\u7684\u6388\u6743\uff0c\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u7533\u8bf7\u4ee4\u724c\u3002<\/li>\n<li>\uff08D\uff09\u8ba4\u8bc1\u670d\u52a1\u5668\u5bf9\u5ba2\u6237\u7aef\u8fdb\u884c\u8ba4\u8bc1\u4ee5\u540e\uff0c\u786e\u8ba4\u65e0\u8bef\uff0c\u540c\u610f\u53d1\u653e\u4ee4\u724c\u3002<\/li>\n<li>\uff08E\uff09\u5ba2\u6237\u7aef\u4f7f\u7528\u4ee4\u724c\uff0c\u5411\u8d44\u6e90\u670d\u52a1\u5668\u7533\u8bf7\u83b7\u53d6\u8d44\u6e90\u3002<\/li>\n<li>\uff08F\uff09\u8d44\u6e90\u670d\u52a1\u5668\u786e\u8ba4\u4ee4\u724c\u65e0\u8bef\uff0c\u540c\u610f\u5411\u5ba2\u6237\u7aef\u5f00\u653e\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<p>\u4e0d\u96be\u770b\u51fa\u6765\uff0c\u4e0a\u9762\u516d\u4e2a\u6b65\u9aa4\u4e4b\u4e2d\uff0cB\u662f\u5173\u952e\uff0c\u5373\u7528\u6237\u600e\u6837\u624d\u80fd\u7ed9\u4e8e\u5ba2\u6237\u7aef\u6388\u6743\u3002\u6709\u4e86\u8fd9\u4e2a\u6388\u6743\u4ee5\u540e\uff0c\u5ba2\u6237\u7aef\u5c31\u53ef\u4ee5\u83b7\u53d6\u4ee4\u724c\uff0c\u8fdb\u800c\u51ed\u4ee4\u724c\u83b7\u53d6\u8d44\u6e90\u3002<\/p>\n<p>\u4e0b\u9762\u4e00\u4e00\u8bb2\u89e3\u5ba2\u6237\u7aef\u83b7\u53d6\u6388\u6743\u7684\u56db\u79cd\u6a21\u5f0f\u3002<\/p>\n<h1>\u4e94\u3001\u5ba2\u6237\u7aef\u7684\u6388\u6743\u6a21\u5f0f<\/h1>\n<p>\u5ba2\u6237\u7aef\u5fc5\u987b\u5f97\u5230\u7528\u6237\u7684\u6388\u6743\uff08authorization grant\uff09\uff0c\u624d\u80fd\u83b7\u5f97\u4ee4\u724c\uff08access token\uff09\u3002OAuth 2.0\u5b9a\u4e49\u4e86\u56db\u79cd\u6388\u6743\u65b9\u5f0f\u3002<\/p>\n<ol>\n<li>\u6388\u6743\u7801\u6a21\u5f0f\uff08authorization code\uff09<\/li>\n<li>\u7b80\u5316\u6a21\u5f0f\uff08implicit\uff09<\/li>\n<li>\u5bc6\u7801\u6a21\u5f0f\uff08resource owner password credentials\uff09<\/li>\n<li>\u5ba2\u6237\u7aef\u6a21\u5f0f\uff08client credentials\uff09<\/li>\n<\/ol>\n<h1>\u516d\u3001\u6388\u6743\u7801\u6a21\u5f0f<\/h1>\n<p>\u6388\u6743\u7801\u6a21\u5f0f\uff08authorization code\uff09\u662f\u529f\u80fd\u6700\u5b8c\u6574\u3001\u6d41\u7a0b\u6700\u4e25\u5bc6\u7684\u6388\u6743\u6a21\u5f0f\u3002\u5b83\u7684\u7279\u70b9\u5c31\u662f\u901a\u8fc7\u5ba2\u6237\u7aef\u7684\u540e\u53f0\u670d\u52a1\u5668\uff0c\u4e0e\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\u7684\u8ba4\u8bc1\u670d\u52a1\u5668\u8fdb\u884c\u4e92\u52a8\u3002<\/p>\n<p><a href=\"http:\/\/fwq.ai\/wp-content\/uploads\/2017\/10\/bg2014051204.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-15425\" src=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051204.png\" width=\"764\" height=\"529\" srcset=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051204.png 764w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051204-300x208.png 300w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051204-670x464.png 670w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" title=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe1\" alt=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe1\" \/><\/a><\/p>\n<p>\u5b83\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\uff08A\uff09\u7528\u6237\u8bbf\u95ee\u5ba2\u6237\u7aef\uff0c\u540e\u8005\u5c06\u524d\u8005\u5bfc\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u3002<\/li>\n<li>\uff08B\uff09\u7528\u6237\u9009\u62e9\u662f\u5426\u7ed9\u4e88\u5ba2\u6237\u7aef\u6388\u6743\u3002<\/li>\n<li>\uff08C\uff09\u5047\u8bbe\u7528\u6237\u7ed9\u4e88\u6388\u6743\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u5c06\u7528\u6237\u5bfc\u5411\u5ba2\u6237\u7aef\u4e8b\u5148\u6307\u5b9a\u7684\u201d\u91cd\u5b9a\u5411URI\u201d\uff08redirection URI\uff09\uff0c\u540c\u65f6\u9644\u4e0a\u4e00\u4e2a\u6388\u6743\u7801\u3002<\/li>\n<li>\uff08D\uff09\u5ba2\u6237\u7aef\u6536\u5230\u6388\u6743\u7801\uff0c\u9644\u4e0a\u65e9\u5148\u7684\u201d\u91cd\u5b9a\u5411URI\u201d\uff0c\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u7533\u8bf7\u4ee4\u724c\u3002\u8fd9\u4e00\u6b65\u662f\u5728\u5ba2\u6237\u7aef\u7684\u540e\u53f0\u7684\u670d\u52a1\u5668\u4e0a\u5b8c\u6210\u7684\uff0c\u5bf9\u7528\u6237\u4e0d\u53ef\u89c1\u3002<\/li>\n<li>\uff08E\uff09\u8ba4\u8bc1\u670d\u52a1\u5668\u6838\u5bf9\u4e86\u6388\u6743\u7801\u548c\u91cd\u5b9a\u5411URI\uff0c\u786e\u8ba4\u65e0\u8bef\u540e\uff0c\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u8bbf\u95ee\u4ee4\u724c\uff08access token\uff09\u548c\u66f4\u65b0\u4ee4\u724c\uff08refresh token\uff09\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e0a\u9762\u8fd9\u4e9b\u6b65\u9aa4\u6240\u9700\u8981\u7684\u53c2\u6570\u3002<br \/>\nA\u6b65\u9aa4\u4e2d\uff0c\u5ba2\u6237\u7aef\u7533\u8bf7\u8ba4\u8bc1\u7684URI\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>response_type\uff1a\u8868\u793a\u6388\u6743\u7c7b\u578b\uff0c\u5fc5\u9009\u9879\uff0c\u6b64\u5904\u7684\u503c\u56fa\u5b9a\u4e3a\u201dcode\u201d<\/li>\n<li>client_id\uff1a\u8868\u793a\u5ba2\u6237\u7aef\u7684ID\uff0c\u5fc5\u9009\u9879<\/li>\n<li>redirect_uri\uff1a\u8868\u793a\u91cd\u5b9a\u5411URI\uff0c\u53ef\u9009\u9879<\/li>\n<li>scope\uff1a\u8868\u793a\u7533\u8bf7\u7684\u6743\u9650\u8303\u56f4\uff0c\u53ef\u9009\u9879<\/li>\n<li>state\uff1a\u8868\u793a\u5ba2\u6237\u7aef\u7684\u5f53\u524d\u72b6\u6001\uff0c\u53ef\u4ee5\u6307\u5b9a\u4efb\u610f\u503c\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u4f1a\u539f\u5c01\u4e0d\u52a8\u5730\u8fd4\u56de\u8fd9\u4e2a\u503c\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>GET \/authorize?response_type=code&amp;client_id=s6BhdRkqt3&amp;state=xyz\r\n    &amp;redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb\r\nHTTP\/1.1\r\nHost: server.example.com<\/pre>\n<p>C\u6b65\u9aa4\u4e2d\uff0c\u670d\u52a1\u5668\u56de\u5e94\u5ba2\u6237\u7aef\u7684URI\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>code\uff1a\u8868\u793a\u6388\u6743\u7801\uff0c\u5fc5\u9009\u9879\u3002\u8be5\u7801\u7684\u6709\u6548\u671f\u5e94\u8be5\u5f88\u77ed\uff0c\u901a\u5e38\u8bbe\u4e3a10\u5206\u949f\uff0c\u5ba2\u6237\u7aef\u53ea\u80fd\u4f7f\u7528\u8be5\u7801\u4e00\u6b21\uff0c\u5426\u5219\u4f1a\u88ab\u6388\u6743\u670d\u52a1\u5668\u62d2\u7edd\u3002\u8be5\u7801\u4e0e\u5ba2\u6237\u7aefID\u548c\u91cd\u5b9a\u5411URI\uff0c\u662f\u4e00\u4e00\u5bf9\u5e94\u5173\u7cfb\u3002<\/li>\n<li>state\uff1a\u5982\u679c\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\u4e2d\u5305\u542b\u8fd9\u4e2a\u53c2\u6570\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u7684\u56de\u5e94\u4e5f\u5fc5\u987b\u4e00\u6a21\u4e00\u6837\u5305\u542b\u8fd9\u4e2a\u53c2\u6570\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>HTTP\/1.1 302 Found\r\nLocation: https:\/\/client.example.com\/cb?code=SplxlOBeZQQYbYS6WxSbIA&amp;state=xyz<\/pre>\n<p>D\u6b65\u9aa4\u4e2d\uff0c\u5ba2\u6237\u7aef\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u7533\u8bf7\u4ee4\u724c\u7684HTTP\u8bf7\u6c42\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>grant_type\uff1a\u8868\u793a\u4f7f\u7528\u7684\u6388\u6743\u6a21\u5f0f\uff0c\u5fc5\u9009\u9879\uff0c\u6b64\u5904\u7684\u503c\u56fa\u5b9a\u4e3a\u201dauthorization_code\u201d\u3002<\/li>\n<li>code\uff1a\u8868\u793a\u4e0a\u4e00\u6b65\u83b7\u5f97\u7684\u6388\u6743\u7801\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>redirect_uri\uff1a\u8868\u793a\u91cd\u5b9a\u5411URI\uff0c\u5fc5\u9009\u9879\uff0c\u4e14\u5fc5\u987b\u4e0eA\u6b65\u9aa4\u4e2d\u7684\u8be5\u53c2\u6570\u503c\u4fdd\u6301\u4e00\u81f4\u3002<\/li>\n<li>client_id\uff1a\u8868\u793a\u5ba2\u6237\u7aefID\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>POST \/token HTTP\/1.1\r\nHost: server.example.com\r\nAuthorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW\r\nContent-Type: application\/x-www-form-urlencoded\r\n\r\ngrant_type=authorization_code&amp;code=SplxlOBeZQQYbYS6WxSbIA\r\n&amp;redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb<\/pre>\n<p>E\u6b65\u9aa4\u4e2d\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u53d1\u9001\u7684HTTP\u56de\u590d\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>access_token\uff1a\u8868\u793a\u8bbf\u95ee\u4ee4\u724c\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>token_type\uff1a\u8868\u793a\u4ee4\u724c\u7c7b\u578b\uff0c\u8be5\u503c\u5927\u5c0f\u5199\u4e0d\u654f\u611f\uff0c\u5fc5\u9009\u9879\uff0c\u53ef\u4ee5\u662fbearer\u7c7b\u578b\u6216mac\u7c7b\u578b\u3002<\/li>\n<li>expires_in\uff1a\u8868\u793a\u8fc7\u671f\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u5982\u679c\u7701\u7565\u8be5\u53c2\u6570\uff0c\u5fc5\u987b\u5176\u4ed6\u65b9\u5f0f\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u3002<\/li>\n<li>refresh_token\uff1a\u8868\u793a\u66f4\u65b0\u4ee4\u724c\uff0c\u7528\u6765\u83b7\u53d6\u4e0b\u4e00\u6b21\u7684\u8bbf\u95ee\u4ee4\u724c\uff0c\u53ef\u9009\u9879\u3002<\/li>\n<li>scope\uff1a\u8868\u793a\u6743\u9650\u8303\u56f4\uff0c\u5982\u679c\u4e0e\u5ba2\u6237\u7aef\u7533\u8bf7\u7684\u8303\u56f4\u4e00\u81f4\uff0c\u6b64\u9879\u53ef\u7701\u7565\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>HTTP\/1.1 200 OK\r\nContent-Type: application\/json;charset=UTF-8\r\nCache-Control: no-store\r\nPragma: no-cache\r\n\r\n{\r\n   \"access_token\":\"2YotnFZFEjr1zCsicMWpAA\",\r\n   \"token_type\":\"example\",\r\n   \"expires_in\":3600,\r\n   \"refresh_token\":\"tGzv3JOkF0XG5Qx2TlKWIA\",\r\n   \"example_parameter\":\"example_value\"\r\n}<\/pre>\n<p>\u4ece\u4e0a\u9762\u4ee3\u7801\u53ef\u4ee5\u770b\u5230\uff0c\u76f8\u5173\u53c2\u6570\u4f7f\u7528JSON\u683c\u5f0f\u53d1\u9001\uff08Content-Type: application\/json\uff09\u3002\u6b64\u5916\uff0cHTTP\u5934\u4fe1\u606f\u4e2d\u660e\u786e\u6307\u5b9a\u4e0d\u5f97\u7f13\u5b58\u3002<\/p>\n<h1>\u4e03\u3001\u7b80\u5316\u6a21\u5f0f<\/h1>\n<p>\u7b80\u5316\u6a21\u5f0f\uff08implicit grant type\uff09\u4e0d\u901a\u8fc7\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u7684\u670d\u52a1\u5668\uff0c\u76f4\u63a5\u5728\u6d4f\u89c8\u5668\u4e2d\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u7533\u8bf7\u4ee4\u724c\uff0c\u8df3\u8fc7\u4e86\u201d\u6388\u6743\u7801\u201d\u8fd9\u4e2a\u6b65\u9aa4\uff0c\u56e0\u6b64\u5f97\u540d\u3002\u6240\u6709\u6b65\u9aa4\u5728\u6d4f\u89c8\u5668\u4e2d\u5b8c\u6210\uff0c\u4ee4\u724c\u5bf9\u8bbf\u95ee\u8005\u662f\u53ef\u89c1\u7684\uff0c\u4e14\u5ba2\u6237\u7aef\u4e0d\u9700\u8981\u8ba4\u8bc1\u3002<\/p>\n<p><a href=\"http:\/\/fwq.ai\/wp-content\/uploads\/2017\/10\/bg2014051205.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-15422\" src=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051205.png\" width=\"671\" height=\"573\" srcset=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051205.png 671w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051205-300x256.png 300w\" sizes=\"auto, (max-width: 671px) 100vw, 671px\" title=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe2\" alt=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe2\" \/><\/a><\/p>\n<p>\u5b83\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\uff08A\uff09\u5ba2\u6237\u7aef\u5c06\u7528\u6237\u5bfc\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u3002<\/li>\n<li>\uff08B\uff09\u7528\u6237\u51b3\u5b9a\u662f\u5426\u7ed9\u4e8e\u5ba2\u6237\u7aef\u6388\u6743\u3002<\/li>\n<li>\uff08C\uff09\u5047\u8bbe\u7528\u6237\u7ed9\u4e88\u6388\u6743\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u5c06\u7528\u6237\u5bfc\u5411\u5ba2\u6237\u7aef\u6307\u5b9a\u7684\u201d\u91cd\u5b9a\u5411URI\u201d\uff0c\u5e76\u5728URI\u7684Hash\u90e8\u5206\u5305\u542b\u4e86\u8bbf\u95ee\u4ee4\u724c\u3002<\/li>\n<li>\uff08D\uff09\u6d4f\u89c8\u5668\u5411\u8d44\u6e90\u670d\u52a1\u5668\u53d1\u51fa\u8bf7\u6c42\uff0c\u5176\u4e2d\u4e0d\u5305\u62ec\u4e0a\u4e00\u6b65\u6536\u5230\u7684Hash\u503c\u3002<\/li>\n<li>\uff08E\uff09\u8d44\u6e90\u670d\u52a1\u5668\u8fd4\u56de\u4e00\u4e2a\u7f51\u9875\uff0c\u5176\u4e2d\u5305\u542b\u7684\u4ee3\u7801\u53ef\u4ee5\u83b7\u53d6Hash\u503c\u4e2d\u7684\u4ee4\u724c\u3002<\/li>\n<li>\uff08F\uff09\u6d4f\u89c8\u5668\u6267\u884c\u4e0a\u4e00\u6b65\u83b7\u5f97\u7684\u811a\u672c\uff0c\u63d0\u53d6\u51fa\u4ee4\u724c\u3002<\/li>\n<li>\uff08G\uff09\u6d4f\u89c8\u5668\u5c06\u4ee4\u724c\u53d1\u7ed9\u5ba2\u6237\u7aef\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e0a\u9762\u8fd9\u4e9b\u6b65\u9aa4\u6240\u9700\u8981\u7684\u53c2\u6570\u3002<\/p>\n<p>A\u6b65\u9aa4\u4e2d\uff0c\u5ba2\u6237\u7aef\u53d1\u51fa\u7684HTTP\u8bf7\u6c42\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>response_type\uff1a\u8868\u793a\u6388\u6743\u7c7b\u578b\uff0c\u6b64\u5904\u7684\u503c\u56fa\u5b9a\u4e3a\u201dtoken\u201d\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>client_id\uff1a\u8868\u793a\u5ba2\u6237\u7aef\u7684ID\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>redirect_uri\uff1a\u8868\u793a\u91cd\u5b9a\u5411\u7684URI\uff0c\u53ef\u9009\u9879\u3002<\/li>\n<li>scope\uff1a\u8868\u793a\u6743\u9650\u8303\u56f4\uff0c\u53ef\u9009\u9879\u3002<\/li>\n<li>state\uff1a\u8868\u793a\u5ba2\u6237\u7aef\u7684\u5f53\u524d\u72b6\u6001\uff0c\u53ef\u4ee5\u6307\u5b9a\u4efb\u610f\u503c\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u4f1a\u539f\u5c01\u4e0d\u52a8\u5730\u8fd4\u56de\u8fd9\u4e2a\u503c\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>GET \/authorize?response_type=token&amp;client_id=s6BhdRkqt3&amp;state=xyz\r\n\u00a0\u00a0\u00a0 &amp;redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb\r\nHTTP\/1.1\r\nHost: server.example.com<\/pre>\n<p>C\u6b65\u9aa4\u4e2d\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u56de\u5e94\u5ba2\u6237\u7aef\u7684URI\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>access_token\uff1a\u8868\u793a\u8bbf\u95ee\u4ee4\u724c\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>token_type\uff1a\u8868\u793a\u4ee4\u724c\u7c7b\u578b\uff0c\u8be5\u503c\u5927\u5c0f\u5199\u4e0d\u654f\u611f\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>expires_in\uff1a\u8868\u793a\u8fc7\u671f\u65f6\u95f4\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u5982\u679c\u7701\u7565\u8be5\u53c2\u6570\uff0c\u5fc5\u987b\u5176\u4ed6\u65b9\u5f0f\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u3002<\/li>\n<li>scope\uff1a\u8868\u793a\u6743\u9650\u8303\u56f4\uff0c\u5982\u679c\u4e0e\u5ba2\u6237\u7aef\u7533\u8bf7\u7684\u8303\u56f4\u4e00\u81f4\uff0c\u6b64\u9879\u53ef\u7701\u7565\u3002<\/li>\n<li>state\uff1a\u5982\u679c\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\u4e2d\u5305\u542b\u8fd9\u4e2a\u53c2\u6570\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u7684\u56de\u5e94\u4e5f\u5fc5\u987b\u4e00\u6a21\u4e00\u6837\u5305\u542b\u8fd9\u4e2a\u53c2\u6570\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre> HTTP\/1.1 302 Found\r\n\u00a0Location: http:\/\/example.com\/cb#access_token=2YotnFZFEjr1zCsicMWpAA\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &amp;state=xyz&amp;token_type=example&amp;expires_in=3600<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u7528HTTP\u5934\u4fe1\u606f\u7684Location\u680f\uff0c\u6307\u5b9a\u6d4f\u89c8\u5668\u91cd\u5b9a\u5411\u7684\u7f51\u5740\u3002\u6ce8\u610f\uff0c\u5728\u8fd9\u4e2a\u7f51\u5740\u7684Hash\u90e8\u5206\u5305\u542b\u4e86\u4ee4\u724c\u3002<\/p>\n<p>\u6839\u636e\u4e0a\u9762\u7684D\u6b65\u9aa4\uff0c\u4e0b\u4e00\u6b65\u6d4f\u89c8\u5668\u4f1a\u8bbf\u95eeLocation\u6307\u5b9a\u7684\u7f51\u5740\uff0c\u4f46\u662fHash\u90e8\u5206\u4e0d\u4f1a\u53d1\u9001\u3002\u63a5\u4e0b\u6765\u7684E\u6b65\u9aa4\uff0c\u670d\u52a1\u63d0\u4f9b\u5546\u7684\u8d44\u6e90\u670d\u52a1\u5668\u53d1\u9001\u8fc7\u6765\u7684\u4ee3\u7801\uff0c\u4f1a\u63d0\u53d6\u51faHash\u4e2d\u7684\u4ee4\u724c\u3002<\/p>\n<h1><strong>\u516b\u3001\u5bc6\u7801\u6a21\u5f0f<\/strong><\/h1>\n<p>\u5bc6\u7801\u6a21\u5f0f\uff08Resource Owner Password Credentials Grant\uff09\u4e2d\uff0c\u7528\u6237\u5411\u5ba2\u6237\u7aef\u63d0\u4f9b\u81ea\u5df1\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002\u5ba2\u6237\u7aef\u4f7f\u7528\u8fd9\u4e9b\u4fe1\u606f\uff0c\u5411\u201d\u670d\u52a1\u5546\u63d0\u4f9b\u5546\u201d\u7d22\u8981\u6388\u6743\u3002<\/p>\n<p>\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\uff0c\u7528\u6237\u5fc5\u987b\u628a\u81ea\u5df1\u7684\u5bc6\u7801\u7ed9\u5ba2\u6237\u7aef\uff0c\u4f46\u662f\u5ba2\u6237\u7aef\u4e0d\u5f97\u50a8\u5b58\u5bc6\u7801\u3002\u8fd9\u901a\u5e38\u7528\u5728\u7528\u6237\u5bf9\u5ba2\u6237\u7aef\u9ad8\u5ea6\u4fe1\u4efb\u7684\u60c5\u51b5\u4e0b\uff0c\u6bd4\u5982\u5ba2\u6237\u7aef\u662f\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e00\u90e8\u5206\uff0c\u6216\u8005\u7531\u4e00\u4e2a\u8457\u540d\u516c\u53f8\u51fa\u54c1\u3002\u800c\u8ba4\u8bc1\u670d\u52a1\u5668\u53ea\u6709\u5728\u5176\u4ed6\u6388\u6743\u6a21\u5f0f\u65e0\u6cd5\u6267\u884c\u7684\u60c5\u51b5\u4e0b\uff0c\u624d\u80fd\u8003\u8651\u4f7f\u7528\u8fd9\u79cd\u6a21\u5f0f\u3002<\/p>\n<p><a href=\"http:\/\/fwq.ai\/wp-content\/uploads\/2017\/10\/bg2014051206.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-15423\" src=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051206.png\" width=\"799\" height=\"406\" srcset=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051206.png 799w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051206-300x152.png 300w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051206-768x390.png 768w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051206-670x340.png 670w\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" title=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe3\" alt=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe3\" \/><\/a><\/p>\n<p>\u5b83\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\uff08A\uff09\u7528\u6237\u5411\u5ba2\u6237\u7aef\u63d0\u4f9b\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/li>\n<li>\uff08B\uff09\u5ba2\u6237\u7aef\u5c06\u7528\u6237\u540d\u548c\u5bc6\u7801\u53d1\u7ed9\u8ba4\u8bc1\u670d\u52a1\u5668\uff0c\u5411\u540e\u8005\u8bf7\u6c42\u4ee4\u724c\u3002<\/li>\n<li>\uff08C\uff09\u8ba4\u8bc1\u670d\u52a1\u5668\u786e\u8ba4\u65e0\u8bef\u540e\uff0c\u5411\u5ba2\u6237\u7aef\u63d0\u4f9b\u8bbf\u95ee\u4ee4\u724c\u3002<\/li>\n<\/ul>\n<p>B\u6b65\u9aa4\u4e2d\uff0c\u5ba2\u6237\u7aef\u53d1\u51fa\u7684HTTP\u8bf7\u6c42\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>grant_type\uff1a\u8868\u793a\u6388\u6743\u7c7b\u578b\uff0c\u6b64\u5904\u7684\u503c\u56fa\u5b9a\u4e3a\u201dpassword\u201d\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>username\uff1a\u8868\u793a\u7528\u6237\u540d\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>password\uff1a\u8868\u793a\u7528\u6237\u7684\u5bc6\u7801\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>scope\uff1a\u8868\u793a\u6743\u9650\u8303\u56f4\uff0c\u53ef\u9009\u9879\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>POST \/token HTTP\/1.1\r\nHost: server.example.com\r\nAuthorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW\r\nContent-Type: application\/x-www-form-urlencoded\r\n\r\ngrant_type=password&amp;username=johndoe&amp;password=A3ddj3w<\/pre>\n<p>C\u6b65\u9aa4\u4e2d\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u8bbf\u95ee\u4ee4\u724c\uff0c\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>\u00a0 HTTP\/1.1 200 OK\r\n\u00a0\u00a0\u00a0\u00a0 Content-Type: application\/json;charset=UTF-8\r\n\u00a0\u00a0\u00a0\u00a0 Cache-Control: no-store\r\n\u00a0\u00a0\u00a0\u00a0 Pragma: no-cache\r\n\r\n\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"access_token\":\"2YotnFZFEjr1zCsicMWpAA\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"token_type\":\"example\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"expires_in\":3600,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"refresh_token\":\"tGzv3JOkF0XG5Qx2TlKWIA\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"example_parameter\":\"example_value\"\r\n\u00a0\u00a0\u00a0\u00a0 }<\/pre>\n<p>\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u5404\u4e2a\u53c2\u6570\u7684\u542b\u4e49\u53c2\u89c1\u300a\u6388\u6743\u7801\u6a21\u5f0f\u300b\u4e00\u8282\u3002<br \/>\n\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u5ba2\u6237\u7aef\u4e0d\u5f97\u4fdd\u5b58\u7528\u6237\u7684\u5bc6\u7801\u3002<\/p>\n<h1>\u4e5d\u3001\u5ba2\u6237\u7aef\u6a21\u5f0f<\/h1>\n<p>\u5ba2\u6237\u7aef\u6a21\u5f0f\uff08Client Credentials Grant\uff09\u6307\u5ba2\u6237\u7aef\u4ee5\u81ea\u5df1\u7684\u540d\u4e49\uff0c\u800c\u4e0d\u662f\u4ee5\u7528\u6237\u7684\u540d\u4e49\uff0c\u5411\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\u8fdb\u884c\u8ba4\u8bc1\u3002\u4e25\u683c\u5730\u8bf4\uff0c\u5ba2\u6237\u7aef\u6a21\u5f0f\u5e76\u4e0d\u5c5e\u4e8eOAuth\u6846\u67b6\u6240\u8981\u89e3\u51b3\u7684\u95ee\u9898\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\uff0c\u7528\u6237\u76f4\u63a5\u5411\u5ba2\u6237\u7aef\u6ce8\u518c\uff0c\u5ba2\u6237\u7aef\u4ee5\u81ea\u5df1\u7684\u540d\u4e49\u8981\u6c42\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\u63d0\u4f9b\u670d\u52a1\uff0c\u5176\u5b9e\u4e0d\u5b58\u5728\u6388\u6743\u95ee\u9898\u3002<\/p>\n<p><a href=\"http:\/\/fwq.ai\/wp-content\/uploads\/2017\/10\/bg2014051207.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-15421\" src=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051207.png\" width=\"802\" height=\"183\" srcset=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051207.png 802w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051207-300x68.png 300w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051207-768x175.png 768w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/bg2014051207-670x153.png 670w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" title=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe4\" alt=\"\u7406\u89e3OAuth 2.0\u63d2\u56fe4\" \/><\/a><\/p>\n<p>\u5b83\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\uff08A\uff09\u5ba2\u6237\u7aef\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u8fdb\u884c\u8eab\u4efd\u8ba4\u8bc1\uff0c\u5e76\u8981\u6c42\u4e00\u4e2a\u8bbf\u95ee\u4ee4\u724c\u3002<\/li>\n<li>\uff08B\uff09\u8ba4\u8bc1\u670d\u52a1\u5668\u786e\u8ba4\u65e0\u8bef\u540e\uff0c\u5411\u5ba2\u6237\u7aef\u63d0\u4f9b\u8bbf\u95ee\u4ee4\u724c\u3002<\/li>\n<\/ul>\n<p>A\u6b65\u9aa4\u4e2d\uff0c\u5ba2\u6237\u7aef\u53d1\u51fa\u7684HTTP\u8bf7\u6c42\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>granttype\uff1a\u8868\u793a\u6388\u6743\u7c7b\u578b\uff0c\u6b64\u5904\u7684\u503c\u56fa\u5b9a\u4e3a\u201dclientcredentials\u201d\uff0c\u5fc5\u9009\u9879\u3002<\/li>\n<li>scope\uff1a\u8868\u793a\u6743\u9650\u8303\u56f4\uff0c\u53ef\u9009\u9879\u3002<\/li>\n<\/ul>\n<pre>POST \/token HTTP\/1.1\r\nHost: server.example.com\r\nAuthorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW\r\nContent-Type: application\/x-www-form-urlencoded\r\n\r\ngrant_type=client_credentials<\/pre>\n<p>\u8ba4\u8bc1\u670d\u52a1\u5668\u5fc5\u987b\u4ee5\u67d0\u79cd\u65b9\u5f0f\uff0c\u9a8c\u8bc1\u5ba2\u6237\u7aef\u8eab\u4efd\u3002<\/p>\n<p>B\u6b65\u9aa4\u4e2d\uff0c\u8ba4\u8bc1\u670d\u52a1\u5668\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u8bbf\u95ee\u4ee4\u724c\uff0c\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre> HTTP\/1.1 200 OK\r\n\u00a0\u00a0\u00a0\u00a0 Content-Type: application\/json;charset=UTF-8\r\n\u00a0\u00a0\u00a0\u00a0 Cache-Control: no-store\r\n\u00a0\u00a0\u00a0\u00a0 Pragma: no-cache\r\n\r\n\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"access_token\":\"2YotnFZFEjr1zCsicMWpAA\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"token_type\":\"example\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"expires_in\":3600,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"example_parameter\":\"example_value\"\r\n\u00a0\u00a0\u00a0\u00a0 }<\/pre>\n<p>\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u5404\u4e2a\u53c2\u6570\u7684\u542b\u4e49\u53c2\u89c1\u300a\u6388\u6743\u7801\u6a21\u5f0f\u300b\u4e00\u8282\u3002<\/p>\n<h1>\u5341\u3001\u66f4\u65b0\u4ee4\u724c<\/h1>\n<p>\u5982\u679c\u7528\u6237\u8bbf\u95ee\u7684\u65f6\u5019\uff0c\u5ba2\u6237\u7aef\u7684\u201d\u8bbf\u95ee\u4ee4\u724c\u201d\u5df2\u7ecf\u8fc7\u671f\uff0c\u5219\u9700\u8981\u4f7f\u7528\u201d\u66f4\u65b0\u4ee4\u724c\u201d\u7533\u8bf7\u4e00\u4e2a\u65b0\u7684\u8bbf\u95ee\u4ee4\u724c\u3002<br \/>\n\u5ba2\u6237\u7aef\u53d1\u51fa\u66f4\u65b0\u4ee4\u724c\u7684HTTP\u8bf7\u6c42\uff0c\u5305\u542b\u4ee5\u4e0b\u53c2\u6570\uff1a<br \/>\ngranttype\uff1a\u8868\u793a\u4f7f\u7528\u7684\u6388\u6743\u6a21\u5f0f\uff0c\u6b64\u5904\u7684\u503c\u56fa\u5b9a\u4e3a\u201drefreshtoken\u201d\uff0c\u5fc5\u9009\u9879\u3002<br \/>\nrefresh_token\uff1a\u8868\u793a\u65e9\u524d\u6536\u5230\u7684\u66f4\u65b0\u4ee4\u724c\uff0c\u5fc5\u9009\u9879\u3002<br \/>\nscope\uff1a\u8868\u793a\u7533\u8bf7\u7684\u6388\u6743\u8303\u56f4\uff0c\u4e0d\u53ef\u4ee5\u8d85\u51fa\u4e0a\u4e00\u6b21\u7533\u8bf7\u7684\u8303\u56f4\uff0c\u5982\u679c\u7701\u7565\u8be5\u53c2\u6570\uff0c\u5219\u8868\u793a\u4e0e\u4e0a\u4e00\u6b21\u4e00\u81f4\u3002<br \/>\n\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<pre>POST \/token HTTP\/1.1\r\n\u00a0\u00a0\u00a0\u00a0 Host: server.example.com\r\n\u00a0\u00a0\u00a0\u00a0 Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW\r\n\u00a0\u00a0\u00a0\u00a0 Content-Type: application\/x-www-form-urlencoded\r\n\r\n\u00a0\u00a0\u00a0\u00a0 grant_type=refresh_token&amp;refresh_token=tGzv3JOkF0XG5Qx2TlKWIA<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>OAuth\u662f\u4e00\u4e2a\u5173\u4e8e\u6388\u6743\uff08authorization\uff09\u7684\u5f00\u653e\u7f51\u7edc\u6807\u51c6\uff0c\u5728\u5168\u4e16\u754c\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\uff0c\u76ee\u524d\u7684\u7248\u672c\u662f2.0\u7248\u3002 \u672c\u6587\u5bf9OAuth 2.0\u7684\u8bbe\u8ba1\u601d\u8def\u548c\u8fd0\u884c\u6d41\u7a0b\uff0c\u505a\u4e00\u4e2a\u7b80\u660e\u901a\u4fd7\u7684\u89e3\u91ca\uff0c\u4e3b\u8981\u53c2\u8003\u6750\u6599\u4e3aRFC 6749\u3002 \u4e00\u3001\u5e94\u7528\u573a\u666f \u4e3a\u4e86\u7406\u89e3OAuth\u7684\u9002\u7528\u573a\u5408\uff0c\u8ba9\u6211\u4e3e\u4e00\u4e2a\u5047\u8bbe\u7684\u4f8b\u5b50\u3002 \u6709\u4e00\u4e2a\u201d\u4e91\u51b2\u5370\u201d\u7684\u7f51\u7ad9\uff0c\u53ef\u4ee5\u5c06\u7528\u6237\u50a8\u5b58\u5728Google\u7684\u7167\u7247\uff0c\u51b2\u5370\u51fa\u6765\u3002\u7528\u6237\u4e3a\u4e86\u4f7f\u7528\u8be5\u670d\u52a1\uff0c\u5fc5\u987b\u8ba9\u201d\u4e91\u51b2\u5370\u201d\u8bfb\u53d6\u81ea\u5df1\u50a8\u5b58\u5728Google\u4e0a\u7684\u7167\u7247\u3002 &nbsp; \u95ee\u9898\u662f\u53ea\u6709\u5f97\u5230\u7528\u6237\u7684\u6388\u6743\uff0cGoogle\u624d\u4f1a\u540c\u610f\u201d\u4e91\u51b2\u5370\u201d\u8bfb\u53d6\u8fd9\u4e9b\u7167\u7247\u3002\u90a3\u4e48\uff0c\u201d\u4e91\u51b2\u5370\u201d\u600e\u6837\u83b7\u5f97\u7528\u6237\u7684\u6388\u6743\u5462\uff1f \u4f20\u7edf\u65b9\u6cd5\u662f\uff0c\u7528\u6237\u5c06\u81ea\u5df1\u7684Google\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u544a\u8bc9\u201d\u4e91\u51b2\u5370\u201d\uff0c\u540e\u8005\u5c31\u53ef\u4ee5\u8bfb\u53d6\u7528\u6237\u7684\u7167\u7247\u4e86\u3002\u8fd9\u6837\u7684\u505a\u6cd5\u6709\u4ee5\u4e0b\u51e0\u4e2a\u4e25\u91cd\u7684\u7f3a\u70b9\u3002 \u201c\u4e91\u51b2\u5370\u201d\u4e3a\u4e86\u540e\u7eed\u7684\u670d\u52a1\uff0c\u4f1a\u4fdd\u5b58\u7528\u6237\u7684\u5bc6\u7801\uff0c\u8fd9\u6837\u5f88\u4e0d\u5b89\u5168\u3002 Google\u4e0d\u5f97\u4e0d\u90e8\u7f72\u5bc6\u7801\u767b\u5f55\uff0c\u800c\u6211\u4eec\u77e5\u9053\uff0c\u5355\u7eaf\u7684\u5bc6\u7801\u767b\u5f55\u5e76\u4e0d\u5b89\u5168\u3002 \u201c\u4e91\u51b2\u5370\u201d\u62e5\u6709\u4e86\u83b7\u53d6\u7528\u6237\u50a8\u5b58\u5728Google\u6240\u6709\u8d44\u6599\u7684\u6743\u529b\uff0c\u7528\u6237\u6ca1\u6cd5\u9650\u5236\u201d\u4e91\u51b2\u5370\u201d\u83b7\u5f97\u6388\u6743\u7684\u8303\u56f4\u548c\u6709\u6548\u671f\u3002 \u7528\u6237\u53ea\u6709\u4fee\u6539\u5bc6\u7801\uff0c\u624d\u80fd\u6536\u56de\u8d4b\u4e88\u201d\u4e91\u51b2\u5370\u201d\u7684\u6743\u529b\u3002\u4f46\u662f\u8fd9\u6837\u505a\uff0c\u4f1a\u4f7f\u5f97\u5176\u4ed6\u6240\u6709\u83b7\u5f97\u7528\u6237\u6388\u6743\u7684\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u5168\u90e8\u5931\u6548\u3002 \u53ea\u8981\u6709\u4e00\u4e2a\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\u88ab\u7834\u89e3\uff0c\u5c31\u4f1a\u5bfc\u81f4\u7528\u6237\u5bc6\u7801\u6cc4\u6f0f\uff0c\u4ee5\u53ca\u6240\u6709\u88ab\u5bc6\u7801\u4fdd\u62a4\u7684\u6570\u636e\u6cc4\u6f0f\u3002 OAuth\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u4e0a\u9762\u8fd9\u4e9b\u95ee\u9898\u800c\u8bde\u751f\u7684\u3002 \u4e8c\u3001\u540d\u8bcd\u5b9a\u4e49 \u5728\u8be6\u7ec6\u8bb2\u89e3OAuth 2.0\u4e4b\u524d\uff0c\u9700\u8981\u4e86\u89e3\u51e0\u4e2a\u4e13\u7528\u540d\u8bcd\u3002\u5b83\u4eec\u5bf9\u8bfb\u61c2\u540e\u9762\u7684\u8bb2\u89e3\uff0c\u5c24\u5176\u662f\u51e0\u5f20\u56fe\uff0c\u81f3\u5173\u91cd\u8981\u3002 Third-party application\uff1a\u7b2c\u4e09\u65b9\u5e94\u7528\u7a0b\u5e8f\uff0c\u672c\u6587\u4e2d\u53c8\u79f0\u201d\u5ba2\u6237\u7aef\u201d\uff08client\uff09\uff0c\u5373\u4e0a\u4e00\u8282\u4f8b\u5b50\u4e2d\u7684\u201d\u4e91\u51b2\u5370\u201d\u3002 HTTP service\uff1aHTTP\u670d\u52a1\u63d0\u4f9b\u5546\uff0c\u672c\u6587\u4e2d\u7b80\u79f0\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\uff0c\u5373\u4e0a\u4e00\u8282\u4f8b\u5b50\u4e2d\u7684Google\u3002 Resource Owner\uff1a\u8d44\u6e90\u6240\u6709\u8005\uff0c\u672c\u6587\u4e2d\u53c8\u79f0\u201d\u7528\u6237\u201d\uff08user\uff09\u3002 User Agent\uff1a\u7528\u6237\u4ee3\u7406\uff0c\u672c\u6587\u4e2d\u5c31\u662f\u6307\u6d4f\u89c8\u5668\u3002 Authorization server\uff1a\u8ba4\u8bc1\u670d\u52a1\u5668\uff0c\u5373\u670d\u52a1\u63d0\u4f9b\u5546\u4e13\u95e8\u7528\u6765\u5904\u7406\u8ba4\u8bc1\u7684\u670d\u52a1\u5668\u3002 Resource server\uff1a\u8d44\u6e90\u670d\u52a1\u5668\uff0c\u5373\u670d\u52a1\u63d0\u4f9b\u5546\u5b58\u653e\u7528\u6237\u751f\u6210\u7684\u8d44\u6e90\u7684\u670d\u52a1\u5668\u3002\u5b83\u4e0e\u8ba4\u8bc1\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u662f\u540c\u4e00\u53f0\u670d\u52a1\u5668\uff0c\u4e5f\u53ef\u4ee5\u662f\u4e0d\u540c\u7684\u670d\u52a1\u5668\u3002 \u77e5\u9053\u4e86\u4e0a\u9762\u8fd9\u4e9b\u540d\u8bcd\uff0c\u5c31\u4e0d\u96be\u7406\u89e3\uff0cOAuth\u7684\u4f5c\u7528\u5c31\u662f\u8ba9\u201d\u5ba2\u6237\u7aef\u201d\u5b89\u5168\u53ef\u63a7\u5730\u83b7\u53d6\u201d\u7528\u6237\u201d\u7684\u6388\u6743\uff0c\u4e0e\u201d\u670d\u52a1\u5546\u63d0\u4f9b\u5546\u201d\u8fdb\u884c\u4e92\u52a8\u3002 \u4e09\u3001OAuth\u7684\u601d\u8def OAuth\u5728\u201d\u5ba2\u6237\u7aef\u201d\u4e0e\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\u4e4b\u95f4\uff0c\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u6388\u6743\u5c42\uff08authorization layer\uff09\u3002\u201d\u5ba2\u6237\u7aef\u201d\u4e0d\u80fd\u76f4\u63a5\u767b\u5f55\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\uff0c\u53ea\u80fd\u767b\u5f55\u6388\u6743\u5c42\uff0c\u4ee5\u6b64\u5c06\u7528\u6237\u4e0e\u5ba2\u6237\u7aef\u533a\u5206\u5f00\u6765\u3002\u201d\u5ba2\u6237\u7aef\u201d\u767b\u5f55\u6388\u6743\u5c42\u6240\u7528\u7684\u4ee4\u724c\uff08token\uff09\uff0c\u4e0e\u7528\u6237\u7684\u5bc6\u7801\u4e0d\u540c\u3002\u7528\u6237\u53ef\u4ee5\u5728\u767b\u5f55\u7684\u65f6\u5019\uff0c\u6307\u5b9a\u6388\u6743\u5c42\u4ee4\u724c\u7684\u6743\u9650\u8303\u56f4\u548c\u6709\u6548\u671f\u3002 \u201c\u5ba2\u6237\u7aef\u201d\u767b\u5f55\u6388\u6743\u5c42\u4ee5\u540e\uff0c\u201d\u670d\u52a1\u63d0\u4f9b\u5546\u201d\u6839\u636e\u4ee4\u724c\u7684\u6743\u9650\u8303\u56f4\u548c\u6709\u6548\u671f\uff0c\u5411\u201d\u5ba2\u6237\u7aef\u201d\u5f00\u653e\u7528\u6237\u50a8\u5b58\u7684\u8d44\u6599\u3002 \u56db\u3001\u8fd0\u884c\u6d41\u7a0b OAuth 2.0\u7684\u8fd0\u884c\u6d41\u7a0b\u5982\u4e0b\u56fe\uff0c\u6458\u81eaRFC 6749\u3002 OAuth\u8fd0\u884c\u6d41\u7a0b \uff08A\uff09\u7528\u6237\u6253\u5f00\u5ba2\u6237\u7aef\u4ee5\u540e\uff0c\u5ba2\u6237\u7aef\u8981\u6c42\u7528\u6237\u7ed9\u4e88\u6388\u6743\u3002 \uff08B\uff09\u7528\u6237\u540c\u610f\u7ed9\u4e88\u5ba2\u6237\u7aef\u6388\u6743\u3002 \uff08C\uff09\u5ba2\u6237\u7aef\u4f7f\u7528\u4e0a\u4e00\u6b65\u83b7\u5f97\u7684\u6388\u6743\uff0c\u5411\u8ba4\u8bc1\u670d\u52a1\u5668\u7533\u8bf7\u4ee4\u724c\u3002 \uff08D\uff09\u8ba4\u8bc1\u670d\u52a1\u5668\u5bf9\u5ba2\u6237\u7aef\u8fdb\u884c\u8ba4\u8bc1\u4ee5\u540e\uff0c\u786e\u8ba4\u65e0\u8bef\uff0c\u540c\u610f\u53d1\u653e\u4ee4\u724c\u3002 \uff08E\uff09\u5ba2\u6237\u7aef\u4f7f\u7528\u4ee4\u724c\uff0c\u5411\u8d44\u6e90\u670d\u52a1\u5668\u7533\u8bf7\u83b7\u53d6\u8d44\u6e90\u3002 \uff08F\uff09\u8d44\u6e90\u670d\u52a1\u5668\u786e\u8ba4\u4ee4\u724c\u65e0\u8bef\uff0c\u540c\u610f\u5411\u5ba2\u6237\u7aef\u5f00\u653e\u8d44\u6e90\u3002 \u4e0d\u96be\u770b\u51fa\u6765\uff0c\u4e0a\u9762\u516d\u4e2a\u6b65\u9aa4\u4e4b\u4e2d\uff0cB\u662f\u5173\u952e\uff0c\u5373\u7528\u6237\u600e\u6837\u624d\u80fd\u7ed9\u4e8e\u5ba2\u6237\u7aef\u6388\u6743\u3002\u6709\u4e86\u8fd9\u4e2a\u6388\u6743\u4ee5\u540e\uff0c\u5ba2\u6237\u7aef\u5c31\u53ef\u4ee5\u83b7\u53d6\u4ee4\u724c\uff0c\u8fdb\u800c\u51ed\u4ee4\u724c\u83b7\u53d6\u8d44\u6e90\u3002 \u4e0b\u9762\u4e00\u4e00\u8bb2\u89e3\u5ba2\u6237\u7aef\u83b7\u53d6\u6388\u6743\u7684\u56db\u79cd\u6a21\u5f0f\u3002 \u4e94\u3001\u5ba2\u6237\u7aef\u7684\u6388\u6743\u6a21\u5f0f \u5ba2\u6237\u7aef\u5fc5\u987b\u5f97\u5230\u7528\u6237\u7684\u6388\u6743\uff08authorization grant\uff09\uff0c\u624d\u80fd\u83b7\u5f97\u4ee4\u724c\uff08access token\uff09\u3002OAuth 2.0\u5b9a\u4e49\u4e86\u56db\u79cd\u6388\u6743\u65b9\u5f0f\u3002 \u6388\u6743\u7801\u6a21\u5f0f\uff08authorization [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-15420","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/15420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=15420"}],"version-history":[{"count":1,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/15420\/revisions"}],"predecessor-version":[{"id":15426,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/15420\/revisions\/15426"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=15420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=15420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=15420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}