0
votes

I created a Google Data Studio Connector that gets data from an rest api I built. Is there a way to get the email address of the Google Account that is seeing the report, which can be different from the user that created the report and datasource?

I can authenticate my connector with my credentials to access the datasource (through OAuth), but I need to be able to get the email of the viewer of the report.

I know this could be resolved by sharing the Data Studio Connector with the viewers, so each viewer can authenticate when creating the datasource, but I don't want to share the Connector with all my viewers, to be sure there's only one person managing the datasource configuration.

Thanks!

1

1 Answers

0
votes

https://developers.google.com/apps-script/reference/base/session#geteffectiveuser

// Log the email address of the user under whose authority the script is running.
var email = Session.getEffectiveUser().getEmail();
Logger.log(email);