401 Unauthorized error when attempting to use PHP cURL post functionality to Google Apps Script 401 Unauthorized error when attempting to use PHP cURL post functionality to Google Apps Script curl curl

401 Unauthorized error when attempting to use PHP cURL post functionality to Google Apps Script


Yes, using Execute the app as: Myself and Who has access to the app: CompanyDomain.com is aboslutely fine but at the same time you have to make sure that google identifies you that you're from CompanyDomain.com only. How are you doing that now ?

I think for that you need to pass authentication details with the requset, maybe something like OAuth/2 token. First get token for the user who is making request and then pass that token in Authentication header so that google identifies the user.

Or, if you dont want that then you can switch to Who has access to the app: Anyone, even anonymous then you don't need to prove your identity.

Choose what suits best for your need.

You can check my answer here also How to create a doPost(e) to receive data from an external service?