Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't authorize sending emails #121

Open
kurokirasama opened this issue May 16, 2023 · 2 comments
Open

I can't authorize sending emails #121

kurokirasama opened this issue May 16, 2023 · 2 comments

Comments

@kurokirasama
Copy link

Hey, I tried adding this:

function sendLog(newvideos){
  var recipient = Session.getActiveUser().getEmail();
  var subject = 'YT2Discord Log: ' + newvideos + 'new videos.';
  var body = Logger.getLog();
  MailApp.sendEmail(recipient, subject, body);  
}

When running a script, I'm usually asked for permissions, but here I'm not, and therefore getting this error message:

Exception: You do not have permission to call Session.getActiveUser. Required permissions: https://www.googleapis.com/auth/userinfo.email
sendLog	@ sendLog.gs:2
updatePlaylists	@ Code.gs:200
@victorjzsun
Copy link
Collaborator

Sometimes google apps script is just finicky with the permissions dialog, have you tried running it again after some time?

@victorjzsun
Copy link
Collaborator

You might also need to add the scope to the manifest.

FYI, here's a way to force the authorize permissions dialog: https://stackoverflow.com/a/52276300, run this and then call any other function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants