{"id":344618,"date":"2023-01-28T21:00:32","date_gmt":"2023-01-28T21:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344618"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344618","title":{"rendered":"<span>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f OAuth 2.0 \u043e\u0442 Google, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u043f\u0443\u0449\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 Python<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 Google \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 API (Application programming interface). \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0443, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e (OAuth 2.0). \u041d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, \u0432 API \u0412\u041a, \u0441 Google \u0432\u0441\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u043f\u0443\u0449\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u0412 \u0441\u0430\u043c\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 API Google, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e, \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0435\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043e\u0441\u043d\u043e\u0432\u0443 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0448\u0435\u0441\u0442\u0438 \u0448\u0430\u0433\u043e\u0432 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/youtube\/v3\/guides\/authentication\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0441\u044e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c<\/a>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\/consent\" rel=\"noopener noreferrer nofollow\">\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c consent screen<\/a> (To create an OAuth client ID, you must first configure your consent screen \u2013 \u0432 \u0442.\u0447. \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435) <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a51\/e1f\/5ff\/a51e1f5ff8b0b26f760835354f21b4f9.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" width=\"1090\" height=\"550\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a51\/e1f\/5ff\/a51e1f5ff8b0b26f760835354f21b4f9.png\"\/><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<p>\u042f \u0432\u044b\u0431\u0440\u0430\u043b User type: External. Scopes \u043d\u0435 \u043c\u0435\u043d\u044f\u043b<\/p>\n<\/li>\n<li>\n<p><em>(\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e)<\/em> <a href=\"https:\/\/developers.google.com\/identity\/protocols\/oauth2\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/a> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/612\/67b\/f6c\/61267bf6c56297f8688e8113afd77eb0.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\" width=\"705\" height=\"661\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/612\/67b\/f6c\/61267bf6c56297f8688e8113afd77eb0.png\"\/><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/figcaption><\/figure>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\/oauthclient\" rel=\"noopener noreferrer nofollow\">OAuth client ID<\/a>. \u042f \u0441\u043e\u0437\u0434\u0430\u043b Web client \u0438 Desktop client (\u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e). \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Client ID \u0438 Client Secret, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 JSON \u0441 credentials \u0432\u043d\u0443\u0442\u0440\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0447\u0442\u043e \u0432\u0441\u0451 \u0443\u0434\u0430\u043b\u043e\u0441\u044c, \u0432 API Explorer \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a <a href=\"https:\/\/youtu.be\/CwoxdhR1z_s\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e, \u0447\u0442\u043e \u0433\u0443\u0433\u043b\u043e\u0432\u0441\u043a\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f Python \u0438\u043d\u0441\u0442\u0430\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a google-api-python-client \u0438 google-auth-oauthlib google-auth-httplib2 , \u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a googleapiclient \u0438 google_auth_oauthlib<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 <code>credentials = flow.run_console()<\/code> \u043d\u0430 <code>credentials = flow.run_local_server()<\/code> . \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <a href=\"https:\/\/drive.google.com\/file\/d\/1xs9Iujtb1jibdPDPzt8F2G1dDxpSqDCq\" rel=\"noopener noreferrer nofollow\">\u0442\u0430\u043a<\/a>.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041d\u043e \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044b, \u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e: \u0441 2022 \u0433\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441: <a href=\"https:\/\/developers.google.com\/identity\/protocols\/oauth2\/resources\/oob-migration\" rel=\"noopener noreferrer nofollow\">https:\/\/developers.google.com\/identity\/protocols\/oauth2\/resources\/oob-migration<\/a> \u0412\u0438\u0434\u0438\u043c\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0437 Google \u0437\u0430\u0431\u044b\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430 API Explorer. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u043d\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 Please visit this URL to authorize this application \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f the authorization code   <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/748\/745\/f3f\/748745f3ff9434ff97685b1d0cc02cfa.png\" alt=\"\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f Out-of-Band (OOB) flow\" title=\"\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f Out-of-Band (OOB) flow\" width=\"1090\" height=\"701\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/748\/745\/f3f\/748745f3ff9434ff97685b1d0cc02cfa.png\"\/><figcaption>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f Out-of-Band (OOB) flow<\/figcaption><\/figure>\n<p>\u041d\u043e authorization code \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Error 400: invalid_request The out-of-band (OOB) flow has been blocked in order to keep users secure. Follow the Out-of-Band (OOB) flow migration guide linked in the developer docs below to migrate your app to an alternative method. Request details: redirect_uri=urn:ietf:wg:oauth:2.0:oob<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/495\/b0e\/6f4\/495b0e6f49faf6777ce3992d065465da.png\" alt=\"\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e Error 400: invalid_request The out-of-band (OOB)\" title=\"\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e Error 400: invalid_request The out-of-band (OOB)\" width=\"530\" height=\"591\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/495\/b0e\/6f4\/495b0e6f49faf6777ce3992d065465da.png\"\/><figcaption>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e Error 400: invalid_request The out-of-band (OOB)<\/figcaption><\/figure>\n<\/li>\n<\/ol>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/713442\/\"> https:\/\/habr.com\/ru\/post\/713442\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 Google \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 API (Application programming interface). \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0443, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e (OAuth 2.0). \u041d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, \u0432 API \u0412\u041a, \u0441 Google \u0432\u0441\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u043f\u0443\u0449\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u0412 \u0441\u0430\u043c\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 API Google, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e, \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0435\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043e\u0441\u043d\u043e\u0432\u0443 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0448\u0435\u0441\u0442\u0438 \u0448\u0430\u0433\u043e\u0432 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043f\u043e\u043b\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/youtube\/v3\/guides\/authentication\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0441\u044e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c<\/a>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\/consent\" rel=\"noopener noreferrer nofollow\">\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c consent screen<\/a> (To create an OAuth client ID, you must first configure your consent screen \u2013 \u0432 \u0442.\u0447. \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435) <\/p>\n<figure class=\"full-width\"><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<p>\u042f \u0432\u044b\u0431\u0440\u0430\u043b User type: External. Scopes \u043d\u0435 \u043c\u0435\u043d\u044f\u043b<\/p>\n<\/li>\n<li>\n<p><em>(\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e)<\/em> <a href=\"https:\/\/developers.google.com\/identity\/protocols\/oauth2\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/a> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <\/p>\n<figure class=\"full-width\"><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/figcaption><\/figure>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\/oauthclient\" rel=\"noopener noreferrer nofollow\">OAuth client ID<\/a>. \u042f \u0441\u043e\u0437\u0434\u0430\u043b Web client \u0438 Desktop client (\u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e). \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Client ID \u0438 Client Secret, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 JSON \u0441 credentials \u0432\u043d\u0443\u0442\u0440\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0447\u0442\u043e \u0432\u0441\u0451 \u0443\u0434\u0430\u043b\u043e\u0441\u044c, \u0432 API Explorer \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a <a href=\"https:\/\/youtu.be\/CwoxdhR1z_s\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e, \u0447\u0442\u043e \u0433\u0443\u0433\u043b\u043e\u0432\u0441\u043a\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f Python \u0438\u043d\u0441\u0442\u0430\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a google-api-python-client \u0438 google-auth-oauthlib google-auth-httplib2 , \u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a googleapiclient \u0438 google_auth_oauthlib<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 <code>credentials = flow.run_console()<\/code> \u043d\u0430 <code>credentials = flow.run_local_server()<\/code> . \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e <a href=\"https:\/\/drive.google.com\/file\/d\/1xs9Iujtb1jibdPDPzt8F2G1dDxpSqDCq\" rel=\"noopener noreferrer nofollow\">\u0442\u0430\u043a<\/a>.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041d\u043e \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044b, \u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e: \u0441 2022 \u0433\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441: <a href=\"https:\/\/developers.google.com\/identity\/protocols\/oauth2\/resources\/oob-migration\" rel=\"noopener noreferrer nofollow\">https:\/\/developers.google.com\/identity\/protocols\/oauth2\/resources\/oob-migration<\/a> \u0412\u0438\u0434\u0438\u043c\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0437 Google \u0437\u0430\u0431\u044b\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430 API Explorer. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u043d\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 Please visit this URL to authorize this application \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f the authorization code   <\/p>\n<figure class=\"full-width\"><figcaption>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f Out-of-Band (OOB) flow<\/figcaption><\/figure>\n<p>\u041d\u043e authorization code \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u0441\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Error 400: invalid_request The out-of-band (OOB) flow has been blocked in order to keep users secure. Follow the Out-of-Band (OOB) flow migration guide linked in the developer docs below to migrate your app to an alternative method. Request details: redirect_uri=urn:ietf:wg:oauth:2.0:oob<\/p>\n<figure class=\"full-width\"><figcaption>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043c\u0435\u043d\u0443, \u0442\u043e Error 400: invalid_request The out-of-band (OOB)<\/figcaption><\/figure>\n<\/li>\n<\/ol>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/713442\/\"> https:\/\/habr.com\/ru\/post\/713442\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344618","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344618"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344618\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}