{"id":311754,"date":"2020-10-20T15:00:50","date_gmt":"2020-10-20T15:00:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=311754"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=311754","title":{"rendered":"\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 node-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a Google Calendar API"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/524240\/\">\n<p>\u041a\u0430\u043a-\u0442\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a Google Calendar API \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0434\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043b\u0435\u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u0448\u0430\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0443\u0441\u043f\u0435\u0445\u043e\u043c.<\/p>\n<p>\u0426\u0435\u043b\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 &#8212; \u0434\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u0430\u044f, \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0443\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 Google.<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0418\u0434\u0451\u043c \u0432 <a href=\"https:\/\/calendar.google.com\/calendar\/\" rel=\"noopener noreferrer nofollow\">Google Calendar<\/a> \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;<strong>+<\/strong>&#187; \u0440\u044f\u0434\u043e\u043c \u0441 &#171;<strong>\u0414\u0440\u0443\u0433\u0438\u0435 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0438<\/strong>&#171;, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0443\u043d\u043a\u0442 &#171;<strong>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c<\/strong>&#171;:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/55a\/1ae\/8b8\/55a1ae8b87be6719342879c4f0fc01e8.jpg\" width=\"580\" height=\"492\"><figcaption><\/figcaption><\/figure>\n<p>\u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u043c\u0451\u043c &#171;<strong>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c<\/strong>&#171;, \u043d\u043e \u0443\u0436\u0435 \u0441\u0438\u043d\u044e\u044e \u043a\u043d\u043e\u043f\u043a\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b87\/8bd\/3fb\/b878bd3fbb0efea509d6739851e1ff2c.png\" width=\"921\" height=\"758\"><figcaption><\/figcaption><\/figure>\n<p>\u0413\u0443\u0433\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u043e \u0448\u0443\u0440\u0448\u0438\u0442 \u043c\u043e\u0437\u0433\u0430\u043c\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0433\u043e\u0442\u043e\u0432. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d2\/750\/f2d\/9d2750f2d2aa9d557f18730b2232153e.jpg\" width=\"605\" height=\"391\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043d\u0430\u0441 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043f\u0443\u043d\u043a\u0442 &#171;<strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f<\/strong>&#171;:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df2\/425\/6cf\/df24256cf83d61a4b03ec01037b9f616.png\" width=\"1255\" height=\"816\"><figcaption><\/figcaption><\/figure>\n<p>\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 &#8212; \u044d\u0442\u043e &#171;<strong>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f<\/strong>&#171;<\/p>\n<pre><code>c093hr4fqjuj5k9e6uvvac73ac@group.calendar.google.com<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435 nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a API.<\/p>\n<h2>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Google<\/h2>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 &#171;<a href=\"https:\/\/console.developers.google.com\/apis\/dashboard\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u043d\u0441\u043e\u043b\u0438 API<\/a>&#171;.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f &#8212; &#171;<strong>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442<\/strong>&#171;:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9e5\/a8c\/2f3\/9e5a8c2f3bb08106149ed2c3dab07524.jpg\" width=\"1248\" height=\"367\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/db0\/abe\/cb4\/db0abecb430aae9c6a33a16cde4f4b58.png\" width=\"754\" height=\"585\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 &#8212; &#171;<em>Habr Demo<\/em>&#171;:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3aa\/180\/4d5\/3aa1804d5cc9cf848ec429139c7b193d.png\" width=\"552\" height=\"156\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c API Google&#8217;\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/822\/1d6\/6c0\/8221d66c0ed116045e61b42eaa5f361c.jpg\" width=\"1195\" height=\"289\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 Google \u043d\u0430\u043f\u043b\u043e\u0434\u0438\u043b \u0441\u0432\u044b\u0448\u0435 3 \u0441\u043e\u0442\u0435\u043d, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0443\u0436\u043d\u044b\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/243\/79e\/bea\/24379ebeaa5af72fd769827a40a1f17f.jpg\" width=\"1196\" height=\"877\"><figcaption><\/figcaption><\/figure>\n<p>\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u043b\u044e\u0447\u0443 &#171;<em>calend<\/em>&#187; \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043c \u0438 \u043d\u0443\u0436\u0435\u043d:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/04f\/5e8\/2e7\/04f5e82e70bb698803cbeae62fad8471.png\" width=\"1188\" height=\"550\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 &#171;<strong>Google Calendar API<\/strong>&#187; \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/141\/94a\/f86\/14194af864d971d3dee2d8064b468fc7.png\" width=\"1192\" height=\"767\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0432 dashboard \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e API \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 (<em>https:\/\/console.developers.google.com\/apis\/api\/calendar-json.googleapis.com\/overview?project=habr-demo-293107&amp;supportedpurview=project<\/em>), \u0433\u0434\u0435 \u043d\u0430\u043c \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f API \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0447\u0451\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/58b\/29d\/72e\/58b29d72eefac9e3252d34b0d31676d7.png\" width=\"1542\" height=\"827\"><figcaption><\/figcaption><\/figure>\n<p>\u0416\u043c\u0451\u043c &#171;<strong>\u0421\u041e\u0417\u0414\u0410\u0422\u042c \u0423\u0427\u0401\u0422\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415<\/strong>&#187; \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0430\u043d\u043a\u0435\u0442\u0443, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e, \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0443\u0447\u0451\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/051\/c8e\/303\/051c8e3030af6dc77d6dfa7f5da45a5d.png\" width=\"993\" height=\"848\"><figcaption><\/figcaption><\/figure>\n<p>\u0432\u0441\u044f \u0430\u043d\u043a\u0435\u0442\u0430 \u043d\u0435 \u0432\u043b\u0435\u0437\u043b\u0430 \u0432 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043d, \u0432\u043e\u0442 \u043e\u0441\u0442\u0430\u0442\u043e\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/847\/7fa\/0bf\/8477fa0bfc2592af3454af10099797a8.png\" width=\"610\" height=\"377\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0430\u043d\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a Google Calendar API:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/287\/b58\/da7\/287b58da7635d8f55b8ea6febca1727f.png\" width=\"709\" height=\"864\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0430\u043c\u0443\u044e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u0443\u043d\u043a\u0442 &#171;<em>\u0420\u043e\u043b\u044c<\/em>&#171;. \u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0440\u043e\u043b\u0435\u0439 \u0443 Google&#8217;\u0430 \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c API, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/83c\/f07\/1de\/83cf071de30df195b835ed496ca1fe5d.jpg\" width=\"655\" height=\"457\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c &#171;<em>\u041f\u0440\u043e\u0435\u043a\u0442 \/ \u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446<\/em>&#171;, \u0442\u043e \u043e\u0431\u0435\u0449\u0430\u044e\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u0416\u043c\u0451\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;<strong>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c<\/strong>&#187; \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c JSON-\u0444\u0430\u0439\u043b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 &#171;<em>Downloads<\/em>&#187; \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u043c\u043f\u0440\u044c\u044e\u0442\u0435\u0440\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e80\/d5a\/c0d\/e80d5ac0d18f5395a78939828a3ce25b.png\" width=\"819\" height=\"580\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 JSON-\u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0435 (\u043a\u043b\u044e\u0447 \u044f \u0432\u044b\u0440\u0435\u0437\u0430\u043b):<\/p>\n<pre><code class=\"json\">{   \"type\": \"service_account\",   \"project_id\": \"habr-demo-293107\",   \"private_key_id\": \"4ec17ea5f8b606e0535a0623a110111123fd3c33\",   \"private_key\": \"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\",   \"client_email\": \"nodejs-app@habr-demo-293107.iam.gserviceaccount.com\",   \"client_id\": \"102219376121816220804\",   \"auth_uri\": \"https:\/\/accounts.google.com\/o\/oauth2\/auth\",   \"token_uri\": \"https:\/\/oauth2.googleapis.com\/token\",   \"auth_provider_x509_cert_url\": \"https:\/\/www.googleapis.com\/oauth2\/v1\/certs\",   \"client_x509_cert_url\": \"https:\/\/www.googleapis.com\/robot\/v1\/metadata\/x509\/nodejs-app%40habr-demo-293107.iam.gserviceaccount.com\" }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 API \u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f &#171;<em>Habr Demo<\/em>&#187; \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 email&#8217;\u043e\u043c &#171;<em>nodejs-app@habr-demo-293107.iam.gserviceaccount.com<\/em>&#171;:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/40d\/ea3\/df7\/40dea3df715c8515bde41fdbf401789f.jpg\" width=\"1532\" height=\"837\"><figcaption><\/figcaption><\/figure>\n<h2>\u041a\u043e\u0434<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a API \u0438\u0437 nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/googleapis\/google-api-nodejs-client\" rel=\"noopener noreferrer nofollow\">googleapis<\/a> \u0438 <a href=\"https:\/\/developers.google.com\/calendar\/quickstart\/nodejs\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u0437\u043e\u0440 \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/a>. \u0412 \u043e\u0431\u0437\u043e\u0440\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f OAuth2-\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0432 <a href=\"https:\/\/developers.google.com\/calendar\/auth#OAuth2Scope\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 scope&#8217;\u0430\u0445<\/a> \u0438 <a href=\"https:\/\/developers.google.com\/calendar\/v3\/reference\/events\/insert#node.js\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/a> \u0432 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code class=\"javascript\">const fs = require('fs'); const {google} = require('googleapis');  const CALENDAR_ID = 'c093hr4fqjuj5k9e6uvvac73ac@group.calendar.google.com'; const KEYFILE = 'Habr Demo-4ec17ea5f8b6.json'; \/\/ path to JSON with private key been downloaded from Google const SCOPE_CALENDAR = 'https:\/\/www.googleapis.com\/auth\/calendar'; \/\/ authorization scopes const SCOPE_EVENTS = 'https:\/\/www.googleapis.com\/auth\/calendar.events';  (async function run() {     \/\/ INNER FUNCTIONS     async function readPrivateKey() {         const content = fs.readFileSync(KEYFILE);         return JSON.parse(content.toString());     }      async function authenticate(key) {         const jwtClient = new google.auth.JWT(             key.client_email,             null,             key.private_key,             [SCOPE_CALENDAR, SCOPE_EVENTS]         );         await jwtClient.authorize();         return jwtClient;     }      async function createEvent(auth) {         const event = {             'summary': 'Habr Post Demo',             'description': '\u0422\u0435\u0441\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 Google Calendar API.',             'start': {                 'dateTime': '2020-10-20T16:00:00+02:00',                 'timeZone': 'Europe\/Riga',             },             'end': {                 'dateTime': '2020-10-20T18:00:00+02:00',                 'timeZone': 'Europe\/Riga',             }         };          let calendar = google.calendar('v3');         await calendar.events.insert({             auth: auth,             calendarId: CALENDAR_ID,             resource: event,         });     }      \/\/ MAIN     try {         const key = await readPrivateKey();         const auth = await authenticate(key);         await createEvent(auth);     } catch (e) {         console.log('Error: ' + e);     } })(); <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 Calendar API:<\/p>\n<pre><code class=\"json\">{   ...   \"status\": 404,   \"statusText\": \"Not Found\",   ... }<\/code><\/pre>\n<p>\u0447\u0442\u043e \u0438 \u043b\u043e\u0433\u0438\u0447\u043d\u043e &#8212; \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044e<\/h2>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u0430\u0448 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435, \u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0436\u043c\u0451\u043c &#171;<strong>\u0414\u043e\u0441\u0442\u0443\u043f \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/strong>&#171;, \u0437\u0430\u0442\u0435\u043c &#171;<strong>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/strong>&#187; \u0438 \u0432\u0432\u043e\u0434\u0438\u043c email-\u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/310\/e36\/836\/310e36836a93c9a6ee7f5f063495b059.png\" width=\"1264\" height=\"874\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/661\/24d\/0ed\/66124d0ed2b25a435edf13986a567e9f.png\" width=\"965\" height=\"244\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c &#171;<strong>\u0412\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/strong>&#171;, \u0438\u043d\u0430\u0447\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 &#171;<em>You need to have writer access to this calendar.<\/em>&#187; \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a API:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/337\/c1d\/7b1\/337c1d7b1d509f2450a209ebdfb880a3.png\" width=\"916\" height=\"343\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437 \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1f4\/f91\/ba9\/1f4f91ba952a58abe9467c14c9c23d21.png\" width=\"1271\" height=\"908\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u044f \u0437\u0430\u0434\u0430\u0432\u0430\u043b \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 16:00:<\/p>\n<pre><code class=\"json\">'start': {     'dateTime': '2020-10-20T16:00:00+02:00',     'timeZone': 'Europe\/Riga', }<\/code><\/pre>\n<p>a \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0430 17:00, \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0443\u0445\u0443 IT:<\/p>\n<blockquote>\n<p>\u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438\u0448\u044c \u0434\u0432\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0438\u044f: \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043a\u0435\u0448\u0430, \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443<\/p>\n<\/blockquote>\n<h2>\u0420\u0435\u0437\u044e\u043c\u0435<\/h2>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451, \u043a\u0432\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d. \u0425\u044d\u043f\u043f\u0438, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u043a\u043e\u0434\u0438\u043d\u0433.<\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/calendar\/v3\/reference\" rel=\"noopener noreferrer nofollow\">Google Calendar API Reference<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/console.developers.google.com\/apis\/dashboard\" rel=\"noopener noreferrer nofollow\">API Console<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/googleapis\/google-api-nodejs-client\" rel=\"noopener noreferrer nofollow\">google-api-nodejs-client<\/a> <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/calendar\/quickstart\/nodejs\" rel=\"noopener noreferrer nofollow\">Node.js Quickstart<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/calendar\/auth#OAuth2Scope\" rel=\"noopener noreferrer nofollow\">Authorization scopes<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \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\/524240\/\"> https:\/\/habr.com\/ru\/post\/524240\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/524240\/\">\n<p>\u041a\u0430\u043a-\u0442\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a Google Calendar API \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0434\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043b\u0435\u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u0448\u0430\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0443\u0441\u043f\u0435\u0445\u043e\u043c.<\/p>\n<p>\u0426\u0435\u043b\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 &#8212; \u0434\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u0430\u044f, \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0443\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 Google.<\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0418\u0434\u0451\u043c \u0432 <a href=\"https:\/\/calendar.google.com\/calendar\/\" rel=\"noopener noreferrer nofollow\">Google Calendar<\/a> \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;<strong>+<\/strong>&#187; \u0440\u044f\u0434\u043e\u043c \u0441 &#171;<strong>\u0414\u0440\u0443\u0433\u0438\u0435 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0438<\/strong>&#171;, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0443\u043d\u043a\u0442 &#171;<strong>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c<\/strong>&#171;:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u043c\u0451\u043c &#171;<strong>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c<\/strong>&#171;, \u043d\u043e \u0443\u0436\u0435 \u0441\u0438\u043d\u044e\u044e \u043a\u043d\u043e\u043f\u043a\u0443:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0413\u0443\u0433\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u043e \u0448\u0443\u0440\u0448\u0438\u0442 \u043c\u043e\u0437\u0433\u0430\u043c\u0438, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0433\u043e\u0442\u043e\u0432. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043d\u0430\u0441 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043f\u0443\u043d\u043a\u0442 &#171;<strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f<\/strong>&#171;:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 &#8212; \u044d\u0442\u043e &#171;<strong>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f<\/strong>&#171;<\/p>\n<pre><code>c093hr4fqjuj5k9e6uvvac73ac@group.calendar.google.com<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435 nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a API.<\/p>\n<h2>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Google<\/h2>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 &#171;<a href=\"https:\/\/console.developers.google.com\/apis\/dashboard\" rel=\"noopener noreferrer nofollow\">\u041a\u043e\u043d\u0441\u043e\u043b\u0438 API<\/a>&#171;.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f &#8212; &#171;<strong>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442<\/strong>&#171;:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 &#8212; &#171;<em>Habr Demo<\/em>&#171;:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c API Google&#8217;\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 Google \u043d\u0430\u043f\u043b\u043e\u0434\u0438\u043b \u0441\u0432\u044b\u0448\u0435 3 \u0441\u043e\u0442\u0435\u043d, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0443\u0436\u043d\u044b\u0445:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u043b\u044e\u0447\u0443 &#171;<em>calend<\/em>&#187; \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043c \u0438 \u043d\u0443\u0436\u0435\u043d:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 &#171;<strong>Google Calendar API<\/strong>&#187; \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0432 dashboard \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e API \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 (<em>https:\/\/console.developers.google.com\/apis\/api\/calendar-json.googleapis.com\/overview?project=habr-demo-293107&amp;supportedpurview=project<\/em>), \u0433\u0434\u0435 \u043d\u0430\u043c \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f API \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0447\u0451\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0416\u043c\u0451\u043c &#171;<strong>\u0421\u041e\u0417\u0414\u0410\u0422\u042c \u0423\u0427\u0401\u0422\u041d\u042b\u0415 \u0414\u0410\u041d\u041d\u042b\u0415<\/strong>&#187; \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0430\u043d\u043a\u0435\u0442\u0443, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e, \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0443\u0447\u0451\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0432\u0441\u044f \u0430\u043d\u043a\u0435\u0442\u0430 \u043d\u0435 \u0432\u043b\u0435\u0437\u043b\u0430 \u0432 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043d, \u0432\u043e\u0442 \u043e\u0441\u0442\u0430\u0442\u043e\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0430\u043d\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a Google Calendar API:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0430\u043c\u0443\u044e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u0443\u043d\u043a\u0442 &#171;<em>\u0420\u043e\u043b\u044c<\/em>&#171;. \u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0440\u043e\u043b\u0435\u0439 \u0443 Google&#8217;\u0430 \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c API, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c &#171;<em>\u041f\u0440\u043e\u0435\u043a\u0442 \/ \u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446<\/em>&#171;, \u0442\u043e \u043e\u0431\u0435\u0449\u0430\u044e\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u0416\u043c\u0451\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 &#171;<strong>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c<\/strong>&#187; \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c JSON-\u0444\u0430\u0439\u043b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 &#171;<em>Downloads<\/em>&#187; \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u043c\u043f\u0440\u044c\u044e\u0442\u0435\u0440\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 JSON-\u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0435 (\u043a\u043b\u044e\u0447 \u044f \u0432\u044b\u0440\u0435\u0437\u0430\u043b):<\/p>\n<pre><code class=\"json\">{   \"type\": \"service_account\",   \"project_id\": \"habr-demo-293107\",   \"private_key_id\": \"4ec17ea5f8b606e0535a0623a110111123fd3c33\",   \"private_key\": \"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\",   \"client_email\": \"nodejs-app@habr-demo-293107.iam.gserviceaccount.com\",   \"client_id\": \"102219376121816220804\",   \"auth_uri\": \"https:\/\/accounts.google.com\/o\/oauth2\/auth\",   \"token_uri\": \"https:\/\/oauth2.googleapis.com\/token\",   \"auth_provider_x509_cert_url\": \"https:\/\/www.googleapis.com\/oauth2\/v1\/certs\",   \"client_x509_cert_url\": \"https:\/\/www.googleapis.com\/robot\/v1\/metadata\/x509\/nodejs-app%40habr-demo-293107.iam.gserviceaccount.com\" }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 API \u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f &#171;<em>Habr Demo<\/em>&#187; \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 email&#8217;\u043e\u043c &#171;<em>nodejs-app@habr-demo-293107.iam.gserviceaccount.com<\/em>&#171;:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041a\u043e\u0434<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a API \u0438\u0437 nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/googleapis\/google-api-nodejs-client\" rel=\"noopener noreferrer nofollow\">googleapis<\/a> \u0438 <a href=\"https:\/\/developers.google.com\/calendar\/quickstart\/nodejs\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u0437\u043e\u0440 \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/a>. \u0412 \u043e\u0431\u0437\u043e\u0440\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f OAuth2-\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0432 <a href=\"https:\/\/developers.google.com\/calendar\/auth#OAuth2Scope\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 scope&#8217;\u0430\u0445<\/a> \u0438 <a href=\"https:\/\/developers.google.com\/calendar\/v3\/reference\/events\/insert#node.js\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/a> \u0432 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code class=\"javascript\">const fs = require('fs'); const {google} = require('googleapis');  const CALENDAR_ID = 'c093hr4fqjuj5k9e6uvvac73ac@group.calendar.google.com'; const KEYFILE = 'Habr Demo-4ec17ea5f8b6.json'; \/\/ path to JSON with private key been downloaded from Google const SCOPE_CALENDAR = 'https:\/\/www.googleapis.com\/auth\/calendar'; \/\/ authorization scopes const SCOPE_EVENTS = 'https:\/\/www.googleapis.com\/auth\/calendar.events';  (async function run() {     \/\/ INNER FUNCTIONS     async function readPrivateKey() {         const content = fs.readFileSync(KEYFILE);         return JSON.parse(content.toString());     }      async function authenticate(key) {         const jwtClient = new google.auth.JWT(             key.client_email,             null,             key.private_key,             [SCOPE_CALENDAR, SCOPE_EVENTS]         );         await jwtClient.authorize();         return jwtClient;     }      async function createEvent(auth) {         const event = {             'summary': 'Habr Post Demo',             'description': '\u0422\u0435\u0441\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 nodejs-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 Google Calendar API.',             'start': {                 'dateTime': '2020-10-20T16:00:00+02:00',                 'timeZone': 'Europe\/Riga',             },             'end': {                 'dateTime': '2020-10-20T18:00:00+02:00',                 'timeZone': 'Europe\/Riga',             }         };          let calendar = google.calendar('v3');         await calendar.events.insert({             auth: auth,             calendarId: CALENDAR_ID,             resource: event,         });     }      \/\/ MAIN     try {         const key = await readPrivateKey();         const auth = await authenticate(key);         await createEvent(auth);     } catch (e) {         console.log('Error: ' + e);     } })(); <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 Calendar API:<\/p>\n<pre><code class=\"json\">{   ...   \"status\": 404,   \"statusText\": \"Not Found\",   ... }<\/code><\/pre>\n<p>\u0447\u0442\u043e \u0438 \u043b\u043e\u0433\u0438\u0447\u043d\u043e &#8212; \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043a \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044e<\/h2>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u0430\u0448 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435, \u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0436\u043c\u0451\u043c &#171;<strong>\u0414\u043e\u0441\u0442\u0443\u043f \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/strong>&#171;, \u0437\u0430\u0442\u0435\u043c &#171;<strong>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/strong>&#187; \u0438 \u0432\u0432\u043e\u0434\u0438\u043c email-\u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c &#171;<strong>\u0412\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/strong>&#171;, \u0438\u043d\u0430\u0447\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u043c\u0435\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 &#171;<em>You need to have writer access to this calendar.<\/em>&#187; \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a API:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437 \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u044f \u0437\u0430\u0434\u0430\u0432\u0430\u043b \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 16:00:<\/p>\n<pre><code class=\"json\">'start': {     'dateTime': '2020-10-20T16:00:00+02:00',     'timeZone': 'Europe\/Riga', }<\/code><\/pre>\n<p>a \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0430 17:00, \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0443\u0445\u0443 IT:<\/p>\n<blockquote>\n<p>\u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438\u0448\u044c \u0434\u0432\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0438\u044f: \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043a\u0435\u0448\u0430, \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443<\/p>\n<\/blockquote>\n<h2>\u0420\u0435\u0437\u044e\u043c\u0435<\/h2>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451, \u043a\u0432\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d. \u0425\u044d\u043f\u043f\u0438, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u043a\u043e\u0434\u0438\u043d\u0433.<\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/calendar\/v3\/reference\" rel=\"noopener noreferrer nofollow\">Google Calendar API Reference<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/console.developers.google.com\/apis\/dashboard\" rel=\"noopener noreferrer nofollow\">API Console<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/googleapis\/google-api-nodejs-client\" rel=\"noopener noreferrer nofollow\">google-api-nodejs-client<\/a> <\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/calendar\/quickstart\/nodejs\" rel=\"noopener noreferrer nofollow\">Node.js Quickstart<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developers.google.com\/calendar\/auth#OAuth2Scope\" rel=\"noopener noreferrer nofollow\">Authorization scopes<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \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\/524240\/\"> https:\/\/habr.com\/ru\/post\/524240\/<\/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-311754","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311754","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=311754"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311754\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}