我在开发过程中遇到一个问题,如果用户没有被授权访问“Drive”,当用户访问Google站点时,系统无法通过“Session.getActiveUser().getEmail()”返回当前用户的email地址,系统返回空值。但是一个月前没问题,我可以在我的 Google 应用程序中通过“Session.getActiveUser().getEmail()”获取用户电子邮件地址,现在不行。为什么?
Google 网站的示例代码:
function doGet(e) {
var app = UiApp.createApplication();
var La = app.createLabel();
app.add(La.setText(Session.getActiveUser().getEmail()));
return app;
}