title: Google apps script UrlFetchApp error "Access not granted or expired"
body: <p>I have created an service account to access domain user's files in google drive to change sharing settings. </p>
  
  <p>Here is the app script code:</p>
  
  <pre><code>`  if(service.hasAccess){
  
          var fileId = activity.events[0].parameters[6].value;
          var url = 'https://www.googleapis.com/drive/v2/files/'+fileId+'/permissions'
          var body = {
            'value': 'domain.com',
            'type': 'domain.com',
            'role': 'writer'
          };
                  Logger.log("done");
           var response = UrlFetchApp.fetch(url, {
            method: 'POST',
            resource: body,
            headers: {
              Authorization: 'Bearer ' + service.getAccessToken()
            }
          });`
  </code></pre>
  
  <p>I can see "done" text in the logs dialog box. So i think the service has access to users drive. But still raising the same error. Am i missing something here? any help would be appreciated, thank you.</p>