I tried to log the user's email for debugging purposes. I used Session.getActiveUser().getEmail()
. I received the following error.
Exception: You do not have permission to call Session.getActiveUser.getEmail() Required permissions: https://www.googleapis.com/auth/userinfo.email
Hence i added the https://www.googleapis.com/auth/userinfo.email
scope to my addon. Now I get the following error
The script does not have permission to get the active user's identity.
However, I don't see the error if I run it on my account(Gsuite) or any other users in our domain. FYI: I am the owner of the addon.
Am I missing any scopes ?
Replacing getActiveUser()
by getEffectiveUser()
seem to make it work.
I think the best explanation is in the official docs. Addon users context does not assume obligatory authorization and getEmail method may return a blank string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With