Search code examples
google-apps-scriptpermissionsgmail

Google AppScript gmail extension error: "You do not have permission to call fetch"


for my company i'm developing a gmail extension through AppScript.

This extension have to retrieve information from another server with an Ajax call and i'm trying with UrlFetchApp.fetch.

So, the situation it's like this:

I've a button that triggers the following function when clicked (really basic..only for test):

function call(){
 var response = UrlFetchApp.fetch("https://www.google.com/");
 Logger.log(response.getContentText());
}

Then, it appears this error: You do not have permission to call fetch (line 116, file "Code").

It seems that the problem is in the permissions of the function. The extension is saved in google drive and i'm using "gmail developer mode" to test this. Do you have any idea?

Thank you :)


Solution

  • You must add this scope in add-on manifest. "https://www.googleapis.com/auth/script.external_request"