1

I am trying to make an API call from a google script to another script file. I published the script I am trying to call as an API. Then tried to make a call.

  var scriptID = 'Script key given by google'
  var request = {
    'funciton':'ClearALL',
  }
  var header = {
    'method':'POST',
    'body':request,
  }
  UrlFetchApp.fetch('https://script.googleapis.com/v1/scripts/' + scriptID + ':run', header)

I received this error:

{ "code": 401, "message": "The request does not have valid authentication credentials.", "status": "UNAUTHENTICATED" } }

So, it seems to me that it is because I am not authorized to make the call to my script.

My question is, how do I send a request for authentication to my script, in google app script? I have fond how to do it in javascript here, but I really don't know how to do it with google script's urlFetch.

Mullenb
  • 651
  • 6
  • 20
  • check this [SO question](http://stackoverflow.com/questions/23752032/passing-authentication-from-one-google-apps-script-webapp-to-another-google-apps), check Zig Mandel and kiwidrew both gave some good points and guides on how to implement of the workaround. I hope it helps. – Mr.Rebot Apr 07 '16 at 12:01

0 Answers0