首页 > 解决方案 > 如何在打开的 google-spreadsheet 上请求 popup-auth-window 以获取用户电子邮件?

问题描述

我试图获取电子邮件(Session.getActiveUser().getEmail()),但我应该询问用户许可:

// it script on google script 
function onOpen() {
Logger.log(Session.getActiveUser().getEmail())
Logger.log(Session.getEffectiveUser().getEmail())
}
// it's manifest for access
{
"timeZone": "Europe/Moscow",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
 "https://www.googleapis.com/auth/spreadsheets.currentonly",
 "https://www.googleapis.com/auth/spreadsheets",
 "https://www.googleapis.com/auth/userinfo.email",
 "https://www.googleapis.com/auth/script.scriptapp"
]
}

我应该如何请求 auth-window?

标签: authenticationgoogle-apps-scriptoauthpopupwindow

解决方案


推荐阅读