{"id":4350,"date":"2014-03-28T16:55:53","date_gmt":"2014-03-28T07:55:53","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=4350"},"modified":"2014-03-28T16:55:53","modified_gmt":"2014-03-28T07:55:53","slug":"google-apps-scriptoauth%e8%aa%8d%e8%a8%bc2-0%e3%81%8c%e5%bf%85%e8%a6%81%e3%81%aaweb-api%e3%82%92%e5%88%a9%e7%94%a8%e3%81%99%e3%82%8b%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=4350","title":{"rendered":"[Google Apps Script]OAuth\u8a8d\u8a3c(2.0)\u304c\u5fc5\u8981\u306aWeb API\u3092\u5229\u7528\u3059\u308b\u3002"},"content":{"rendered":"<p><a href=\"\/\/www.ka-net.org\/blog\/?p=4326\" title=\"[Google Apps Script]Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3002\" target=\"_blank\">\u524d\u56de\u306e\u8a18\u4e8b<\/a>\u3067\u306fGoogle Apps Script\u3092\u4f7f\u3063\u3066Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u624b\u9806\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089OAuth\u8a8d\u8a3c(2.0)\u304c\u5fc5\u8981\u306aWeb API\u3092\u5229\u7528\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059(\u4f8b:Google URL Shortener API)\u3002<\/p>\n<ol>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u307e\u305a\u306f\u30a2\u30d7\u30ea\u306e\u6e96\u5099\u3092\u884c\u3044\u307e\u3059\u3002<\/span><\/p>\n<li>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u30a6\u30a7\u30d6 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eURL<\/span>(\u3053\u3053\u3067\u306f\u30c6\u30b9\u30c8\u7528)\u3092\u53d6\u5f97\u3057\u307e\u3059(\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=4326\" title=\"[Google Apps Script]Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3002\" target=\"_blank\">[Google Apps Script]Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3002<\/a>\u300d\u53c2\u7167)\u3002<\/li>\n<li>\u30a6\u30a7\u30d6 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eURL\u306e\u672b\u5c3e\u3092\u300c<span style=\"color: #ff0000; font-weight: bold;\">\/usercallback<\/span>\u300d\u306b\u66f8\u304d\u63db\u3048\u305f\u3082\u306e\u3092<span style=\"color: #ff0000; font-weight: bold;\">\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306eURL<\/span>\u3068\u3057\u3066\u63a7\u3048\u3066\u304a\u304d\u307e\u3059\u3002<\/li>\n<p>https:\/\/script.google.com\/macros\/s\/EFGH<span style=\"color: #ff0000; font-weight: bold;\">\/dev<\/span><br \/>\n&darr;<br \/>\nhttps:\/\/script.google.com\/macros\/s\/EFGH<span style=\"color: #ff0000; font-weight: bold;\">\/usercallback<\/span><\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b Google API\u306e\u6e96\u5099\u3092\u884c\u3044\u307e\u3059\u3002<\/span><\/p>\n<li><a href=\"https:\/\/code.google.com\/apis\/console\" title=\"Google Developers Console\" target=\"_blank\">API \u30b3\u30f3\u30bd\u30fc\u30eb<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/li>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">Services<\/span>\u300d\u304b\u3089\u5229\u7528\u3059\u308bAPI\u3092\u300c<span style=\"color: #ff0000; font-weight: bold;\">ON<\/span>\u300d\u306b\u3057\u307e\u3059(\u3053\u3053\u3067\u306f<span style=\"color: #ff0000; font-weight: bold;\">URL Shortener API<\/span>)\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_01.jpg\" alt=\"GoogleAppsScript_13_01\" width=\"325\" height=\"215\" class=\"alignnone size-full wp-image-4351\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_01.jpg 325w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_01-300x198.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_01-220x146.jpg 220w\" sizes=\"auto, (max-width: 325px) 100vw, 325px\" \/><\/a><\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_02.jpg\" alt=\"GoogleAppsScript_13_02\" width=\"652\" height=\"76\" class=\"alignnone size-full wp-image-4352\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_02.jpg 652w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_02-300x34.jpg 300w\" sizes=\"auto, (max-width: 652px) 100vw, 652px\" \/><\/a><\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_03.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_03.jpg\" alt=\"GoogleAppsScript_13_03\" width=\"652\" height=\"76\" class=\"alignnone size-full wp-image-4353\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_03.jpg 652w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_03-300x34.jpg 300w\" sizes=\"auto, (max-width: 652px) 100vw, 652px\" \/><\/a><\/p>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">API Access<\/span>\u300d\u304b\u3089\u300c<span style=\"color: #ff0000; font-weight: bold;\">Create an OAuth 2.0 client ID&#8230;<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_04.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_04.jpg\" alt=\"GoogleAppsScript_13_04\" width=\"732\" height=\"342\" class=\"alignnone size-full wp-image-4354\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_04.jpg 732w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_04-300x140.jpg 300w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/a><\/p>\n<li>Branding Information\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u5fc5\u8981\u4e8b\u9805(\u3053\u3053\u3067\u306fProduct name:\u306e\u307f)\u3092\u5165\u529b\u5f8c\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">Next<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_05.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_05.jpg\" alt=\"GoogleAppsScript_13_05\" width=\"628\" height=\"449\" class=\"alignnone size-full wp-image-4355\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_05.jpg 628w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_05-300x214.jpg 300w\" sizes=\"auto, (max-width: 628px) 100vw, 628px\" \/><\/a><\/p>\n<li>Client ID Settings\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u300c<span style=\"color: #ff0000; font-weight: bold;\">Web application<\/span>\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_06.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_06.jpg\" alt=\"GoogleAppsScript_13_06\" width=\"627\" height=\"489\" class=\"alignnone size-full wp-image-4357\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_06.jpg 627w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_06-300x233.jpg 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/a><\/p>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">(more options)<\/span>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">Authorized Redirect URIs<\/span>\u300d\u6b04\u306b\u624b\u98062.\u3067\u7528\u610f\u3057\u305f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306eURL\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_07.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_07.jpg\" alt=\"GoogleAppsScript_13_07\" width=\"627\" height=\"586\" class=\"alignnone size-full wp-image-4358\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_07.jpg 627w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_07-300x280.jpg 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/a><\/p>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">Authorized JavaScript Origins<\/span>\u300d\u6b04\u306b\u306f\u300c<span style=\"color: #ff0000; font-weight: bold;\">https:\/\/script.google.com<\/span>\u300d\u3068\u5165\u529b\u3057\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">Create client ID<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_08.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_08.jpg\" alt=\"GoogleAppsScript_13_08\" width=\"627\" height=\"586\" class=\"alignnone size-full wp-image-4359\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_08.jpg 627w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_08-300x280.jpg 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/a><\/p>\n<li>API Access\u753b\u9762\u306b\u4f5c\u6210\u3057\u305f<span style=\"color: #ff0000; font-weight: bold;\">Client ID<\/span>\u3084<span style=\"color: #ff0000; font-weight: bold;\">Client secret<\/span>\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u3053\u308c\u3089\u3092\u30e1\u30e2\u5e33\u306b\u3067\u3082\u63a7\u3048\u3066\u304a\u304d\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_09.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_09.jpg\" alt=\"GoogleAppsScript_13_09\" width=\"836\" height=\"236\" class=\"alignnone size-full wp-image-4360\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_09.jpg 836w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_09-300x84.jpg 300w\" sizes=\"auto, (max-width: 836px) 100vw, 836px\" \/><\/a><\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u518d\u3073\u30b9\u30af\u30ea\u30d7\u30c8 \u30a8\u30c7\u30a3\u30bf\u3067\u306e\u4f5c\u696d\u306b\u623b\u308a\u307e\u3059\u3002<\/span><\/p>\n<li>\u30b3\u30fc\u30c9.gs\u306b\u4e0b\u8a18\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u3001<span style=\"color: #ff0000; font-weight: bold;\">Client ID<\/span>\u3068<span style=\"color: #ff0000; font-weight: bold;\">Client secret<\/span>\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306eURL<\/span>\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">var client_id = ''; \/\/\u30af\u30e9\u30a4\u30a2\u30f3\u30c8ID(Client ID)\r\nvar client_secret = ''; \/\/\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30b7\u30fc\u30af\u30ec\u30c3\u30c8(Client secret)\r\nvar redirect_uri = ''; \/\/\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306eURL\r\nvar scope = 'https:\/\/www.googleapis.com\/auth\/urlshortener'; \/\/API\u306b\u3088\u3063\u3066\u8981\u5909\u66f4\r\n\r\nfunction doGet(){\r\n    var url = 'https:\/\/accounts.google.com\/o\/oauth2\/auth?client_id=' + client_id;\r\n    url += '&amp;redirect_uri=' + encodeURIComponent(redirect_uri);\r\n    url += '&amp;scope=' + encodeURIComponent(scope);\r\n    url += '&amp;state=' + ScriptApp.newStateToken().withMethod('callback').withArgument('name', 'value').withTimeout(2000).createToken();\r\n    url += '&amp;response_type=code';\r\n    url += '&amp;access_type=offline';\r\n    \r\n    return HtmlService.createHtmlOutput('&lt;a href=&quot;' + url + '&quot;&gt;\u8a8d\u8a3c&lt;\/a&gt;');\r\n}\r\n\r\nfunction callback(e){\r\n    \/\/---------- Access Token\u53d6\u5f97\u3053\u3053\u304b\u3089 ----------\r\n    var opt = {\r\n        &quot;method&quot; : &quot;POST&quot;,\r\n        &quot;payload&quot; : {\r\n            &quot;code&quot; : e.parameter.code,\r\n            &quot;client_id&quot; : client_id,\r\n            &quot;client_secret&quot; : client_secret,\r\n            &quot;redirect_uri&quot; :redirect_uri,\r\n            &quot;grant_type&quot; : &quot;authorization_code&quot;\r\n        },\r\n        &quot;muteHttpExceptions&quot; : true\r\n    };\r\n    var res = UrlFetchApp.fetch('https:\/\/accounts.google.com\/o\/oauth2\/token', opt);\r\n    var dat = JSON.parse(res.getContentText());\r\n    var access_token = dat.access_token;\r\n    \/\/---------- Access Token\u53d6\u5f97\u3053\u3053\u307e\u3067 ----------\r\n    \r\n    \/\/---------- API\u4f7f\u7528\u4f8b\u3053\u3053\u304b\u3089 ----------\r\n    opt = {\r\n        &quot;method&quot; : &quot;GET&quot;,\r\n        &quot;headers&quot; : {\r\n            &quot;Authorization&quot;: &quot;Bearer &quot; + access_token\r\n        }\r\n    };\r\n    res = UrlFetchApp.fetch('https:\/\/www.googleapis.com\/urlshortener\/v1\/url\/history', opt);\r\n    \/\/---------- API\u4f7f\u7528\u4f8b\u3053\u3053\u307e\u3067 ----------\r\n    \r\n    return HtmlService.createHtmlOutput('&lt;pre&gt;' + res.getContentText() + '&lt;\/pre&gt;');\r\n}<\/pre>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">doGet<\/span>\u300d\u95a2\u6570\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_10.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_10.jpg\" alt=\"GoogleAppsScript_13_10\" width=\"633\" height=\"212\" class=\"alignnone size-full wp-image-4361\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_10.jpg 633w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_10-300x100.jpg 300w\" sizes=\"auto, (max-width: 633px) 100vw, 633px\" \/><\/a><\/p>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u627f\u8a8d\u304c\u5fc5\u8981\u3067\u3059<\/span>\u300d\u3068\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u7d9a\u884c<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_11.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_11.jpg\" alt=\"GoogleAppsScript_13_11\" width=\"289\" height=\"177\" class=\"alignnone size-full wp-image-4362\" \/><\/a><\/p>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u3053\u306e\u30a2\u30d7\u30ea\u304c\u6b21\u306e\u8a31\u53ef\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/span>\u300d\u3068\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u627f\u8a8d\u3059\u308b<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_12.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_12.jpg\" alt=\"GoogleAppsScript_13_12\" width=\"598\" height=\"499\" class=\"alignnone size-full wp-image-4363\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_12.jpg 598w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_12-300x250.jpg 300w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<li>\u624b\u98061.\u3067\u53d6\u5f97\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3044\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_13.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_13.jpg\" alt=\"GoogleAppsScript_13_13\" width=\"357\" height=\"132\" class=\"alignnone size-full wp-image-4364\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_13.jpg 357w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_13-300x110.jpg 300w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/a><\/p>\n<li>\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u8a8d\u8a3c<\/span>\u300d\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u3053\u306e\u30a2\u30d7\u30ea\u304c\u6b21\u306e\u8a31\u53ef\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/span>\u300d\u3068\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067(OAuth\u8a8d\u8a3c\u753b\u9762)\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u627f\u8a8d\u3059\u308b<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_14.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_14.jpg\" alt=\"GoogleAppsScript_13_14\" width=\"420\" height=\"386\" class=\"alignnone size-full wp-image-4365\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_14.jpg 420w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_14-300x275.jpg 300w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/a><\/p>\n<li>\u554f\u984c\u7121\u304f\u8a8d\u8a3c\u304c\u884c\u308f\u308c\u308c\u3070\u3001\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3(Access Token)\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001OAuth\u8a8d\u8a3c\u304c\u5fc5\u8981\u306aAPI\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_15.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_15.jpg\" alt=\"GoogleAppsScript_13_15\" width=\"474\" height=\"487\" class=\"alignnone size-full wp-image-4366\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_15.jpg 474w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_13_15-291x300.jpg 291w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a>\n<\/ol>\n<p>doGet\u95a2\u6570\u3067\u8a8d\u8a3c\u753b\u9762\u3078\u306e\u30ea\u30f3\u30af\u4f5c\u6210\u3002<br \/>\n&darr;<br \/>\n\u8a8d\u8a3c\u753b\u9762\u3067\u8a8d\u8a3c\u3092\u884c\u3044\u3001\u30da\u30fc\u30b8\u304c\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u308b\u3068callback\u95a2\u6570\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002<br \/>\n&darr;<br \/>\ncallback\u95a2\u6570\u306e\u4e2d\u3067\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u3001Web API\u3092\u5229\u7528\u3057\u305f\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308b\u3002<\/p>\n<p>\u3068\u3044\u3063\u305f\u51e6\u7406\u306e\u6d41\u308c\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8981\u3059\u308b\u306b\u3001<span style=\"color: #ff0000; font-weight: bold;\">ScriptApp.newStateToken()\u3092\u4f7f\u3063\u3066\/usercallback\u306bstate\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3059\u3068\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u51e6\u7406\u3067\u3044\u308d\u3044\u308d\u3067\u304d\u308b<\/span>\u3001\u3068\u3044\u3046\u3053\u3068\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30b3\u30fc\u30c9\u3092\u30c6\u30b9\u30c8\u3059\u308b\u306b\u3042\u305f\u3063\u3066\u3001\u4e0b\u8a18Web\u30da\u30fc\u30b8\u3001\u7279\u306b\u300c<a href=\"http:\/\/qiita.com\/soundTricker\/items\/b4df3072088fcbd0e36d\" title=\"GoogleAppsScript - Google Apps Script DE OAuth2 \uff5e GAS\u3067\u76f4\u63a5\u89e6\u308c\u306a\u3044 Google API\u3092\u53e9\u3044\u3066\u307f\u308b\u304a\uff5e - Qiita\" target=\"_blank\">GoogleAppsScript &#8211; Google Apps Script DE OAuth2 \uff5e GAS\u3067\u76f4\u63a5\u89e6\u308c\u306a\u3044 Google API\u3092\u53e9\u3044\u3066\u307f\u308b\u304a\uff5e<\/a>\u300d\u304c\u3068\u3066\u3082\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h4>\u25a0 \u53c2\u8003Web\u30da\u30fc\u30b8<\/h4>\n<p><strong>\u30fbGoogleAppsScript &#8211; Google Apps Script DE OAuth2 \uff5e GAS\u3067\u76f4\u63a5\u89e6\u308c\u306a\u3044 Google API\u3092\u53e9\u3044\u3066\u307f\u308b\u304a\uff5e &#8211; Qiita<\/strong><br \/>\n<a href=\"http:\/\/qiita.com\/soundTricker\/items\/b4df3072088fcbd0e36d\" title=\"GoogleAppsScript - Google Apps Script DE OAuth2 \uff5e GAS\u3067\u76f4\u63a5\u89e6\u308c\u306a\u3044 Google API\u3092\u53e9\u3044\u3066\u307f\u308b\u304a\uff5e - Qiita\" target=\"_blank\">http:\/\/qiita.com\/soundTricker\/items\/b4df3072088fcbd0e36d<\/a><br \/>\n<strong>\u30fb\u5929\u4f7f\u3084\u30ab\u30a4\u30b6\u30fc\u3068\u547c\u3070\u308c\u3066 \u226b OAuth2.0\u306b\u3088\u308bGoogle+ API\u306e\u30a2\u30af\u30bb\u30b9\u65b9\u6cd5<\/strong><br \/>\n<a href=\"http:\/\/www.eisbahn.jp\/yoichiro\/2011\/10\/oauth2-0_google-api.html\" title=\"\u5929\u4f7f\u3084\u30ab\u30a4\u30b6\u30fc\u3068\u547c\u3070\u308c\u3066 \u226b OAuth2.0\u306b\u3088\u308bGoogle+ API\u306e\u30a2\u30af\u30bb\u30b9\u65b9\u6cd5\" target=\"_blank\">http:\/\/www.eisbahn.jp\/yoichiro\/2011\/10\/oauth2-0_google-api.html<\/a><br \/>\n<strong>\u30fbUsing OAuth 2.0 for Web Server Applications &#8211; Google Accounts Authentication and Authorization &#8211; Google Developers<\/strong><br \/>\n<a href=\"https:\/\/developers.google.com\/accounts\/docs\/OAuth2WebServer?hl=ja\" title=\"Using OAuth 2.0 for Web Server Applications - Google Accounts Authentication and Authorization - Google Developers\" target=\"_blank\">https:\/\/developers.google.com\/accounts\/docs\/OAuth2WebServer?hl=ja<\/a><br \/>\n<strong>\u30fbGetting Started &#8211; URL Shortener API &#8211; Google Developers<\/strong><br \/>\n<a href=\"https:\/\/developers.google.com\/url-shortener\/v1\/getting_started?hl=ja\" title=\"Getting Started - URL Shortener API - Google Developers\" target=\"_blank\">https:\/\/developers.google.com\/url-shortener\/v1\/getting_started?hl=ja<\/a><br \/>\n<strong>\u30fbnewStateToken()<\/strong><br \/>\n<a href=\"https:\/\/developers.google.com\/apps-script\/reference\/script\/script-app?hl=ja#newStateToken%28%29\" title=\"newStateToken()\" target=\"_blank\">https:\/\/developers.google.com\/apps-script\/reference\/script\/script-app?hl=ja#newStateToken%28%29<\/a><br \/>\n<strong>\u30fbClass StateTokenBuilder<\/strong><br \/>\n<a href=\"https:\/\/developers.google.com\/apps-script\/reference\/script\/state-token-builder?hl=ja\" title=\"Class StateTokenBuilder\" target=\"_blank\">https:\/\/developers.google.com\/apps-script\/reference\/script\/state-token-builder?hl=ja<\/a><\/p>\n<h4>\u3010\u7de8\u96c6\u5f8c\u8a18\u3011<\/h4>\n<p>\u4eca\u56de\u306e\u30b3\u30fc\u30c9\u3001\u5b9f\u306f\u30c6\u30b9\u30c8\u6642\u306b\u307e\u3063\u305f\u304f\u4e0a\u624b\u304f\u884c\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\nauthorization code\u3092POST\u3059\u308b\u3068\u304d\u306bredirect_uri\u3092URL\u30a8\u30f3\u30b3\u30fc\u30c9\u3057\u3066\u3057\u307e\u3063\u305f\u3053\u3068\u304c\u539f\u56e0\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u306b\u6c17\u4ed8\u304f\u307e\u3067\u5927\u5206\u6642\u9593\u304c\u639b\u304b\u308a\u307e\u3057\u305f\u3002<br \/>\n\u30b3\u30fc\u30c9\u306f\u3088\u304f\u898b\u306a\u3044\u3068\u30c0\u30e1\u3067\u3059\u306d\u30fb\u30fb\u30fb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u524d\u56de\u306e\u8a18\u4e8b\u3067\u306fGoogle Apps Script\u3092\u4f7f\u3063\u3066Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u624b\u9806\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089OAuth\u8a8d\u8a3c(2.0)\u304c\u5fc5\u8981\u306aWeb API\u3092\u5229\u7528\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059(\u4f8b [&hellip;]","protected":false},"author":1,"featured_media":7113,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[126],"tags":[],"class_list":["post-4350","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Google.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-18a","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4350"}],"version-history":[{"count":4,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4350\/revisions"}],"predecessor-version":[{"id":4369,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4350\/revisions\/4369"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7113"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}