调用 getOAuthToken returns 空值 - 我错过了什么?
The call getOAuthToken returns null value - what am I missing?
我需要在 Apps 脚本中使用文件选择器,我已经尝试了
Google Documentation 但它不起作用 - ScriptApp.getOAuthToken() 调用返回 null。
我已按照所有说明更改为标准云项目并启用了 Google 选择器 API,但它就是不开心。
所以实际上是调用 DriveApp.getRootFolder() 在示例代码中提供的函数中失败:
function getOAuthToken() {
try {
DriveApp.getRootFolder();
return ScriptApp.getOAuthToken();
} catch (e) {
// TODO (Developer) - Handle exception
Logger.log('Failed with error: %s', e.error);
}
}
虽然 sample code 在没有此调用的情况下也能正常工作,但我发现错误的原因是我需要在切换到标准云项目后启用 Google 驱动器 API (需要 运行 Google 选择器 API)。
我需要在 Apps 脚本中使用文件选择器,我已经尝试了 Google Documentation 但它不起作用 - ScriptApp.getOAuthToken() 调用返回 null。
我已按照所有说明更改为标准云项目并启用了 Google 选择器 API,但它就是不开心。
所以实际上是调用 DriveApp.getRootFolder() 在示例代码中提供的函数中失败:
function getOAuthToken() {
try {
DriveApp.getRootFolder();
return ScriptApp.getOAuthToken();
} catch (e) {
// TODO (Developer) - Handle exception
Logger.log('Failed with error: %s', e.error);
}
}
虽然 sample code 在没有此调用的情况下也能正常工作,但我发现错误的原因是我需要在切换到标准云项目后启用 Google 驱动器 API (需要 运行 Google 选择器 API)。