2

Is there any way to invoke a Google Apps Script which serves content and limited to a domain within another Google Apps Script which is invoked by a user who is in that domain? Basically the content serve script is something which runs on administrator of the domain and serves private information.

I think it should work when content serving script is made, available to anonymous usage, but I wanted the content serving script to be available only within domain.

2
  • have you seen this other post ? Commented Mar 14, 2013 at 15:45
  • I saw that post earlier, thats not exactly what I am looking for. Commented Mar 18, 2013 at 10:23

3 Answers 3

4

You could publish the first script as a web service, and then just call the functions remotely. This can be done because when you publish as a web application you set the permissions with which the script gets executed.

https://developers.google.com/apps-script/execution_web_apps

Sign up to request clarification or add additional context in comments.

Comments

0

Unfortunately, this isn't possible, as the script request aren't executed in the name of the author neither the user executing it, setting anonymous usage for the script should work.

But you can pass an argument through post or get. so even if anyone can invoke the script, only the script invoked with a key argument will do something

The question that remain is what to use: get or post I don't know if request made by the script are done in https, so it's maybe a better solution to use post.

1 Comment

Yes, Anonymous sharing setting works perfectly. A URL fetch with GET can do the task. var response = UrlFetchApp.fetch("script.google.com/a/macros/domain.com/s/script_key/…;
0

is a library what you're looking for? Remember this may slow down executions (vs just binding the script to multiple files like normal)

https://support.google.com/docs/thread/13371261?hl=en Yes, it is possible. The simplest solution is to create an Apps Script library. You can use either a standalone script or a bound script as the library. I prefer to use a standalone to make it easier to access, and you won't be able to use functions that are specific to bound scripts that could mess up your script.

HERE is a quick video demonstrating how to get a GAS library setup. https://www.youtube.com/watch?v=TqWtSp4IJcg&feature=youtu.be

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.