使用API​​密钥和Javascript使用Google Apps脚本执行API [英] Use Google Apps Script Execution API with API keys and Javascript

查看:126
本文介绍了使用API​​密钥和Javascript使用Google Apps脚本执行API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的客户创建一个Web应用程序,并使用Google驱动器来存储信息。
由于无法将Google应用程序脚本中的Web应用程序集成到我自己的网站中,因此我尝试使用Google Apps脚本执行API和Javascript在我的网站和Google Drive之间进行交互。



我发现一些例子像这样:
https://mashe.hawksey.info/2015/10/google-sheets-as-a-database-authenticated-insert- with-apps-script-using-execution-api /
我能够重现这个例子,但它使用了一个Auth认证。



我想使用Google Apps脚本执行API,而无需身份验证,但只需使用简单的API密钥。



可以吗?你有一个例子来说明这一点。



感谢您的帮助, / div>

是的,你可以做到这一点。请参阅有关使用应用程序脚本进行网络部署的指南。您只需要以自己的用户身份运行Web应用程序(参数执行应用程序)。但是,您将只能访问自己的Google云端硬盘,这可能没那么有用。如果你想访问他人的驱动器,那么你必须以当前用户的身份运行网络应用程序,但这将提示权限(第一次用户访问你的应用程序)。


I want to create a web application for my client and use Google drive to store information. Since it's impossibe to integrate a web application from google apps script in my own website I try to use Google Apps Script Execution API and Javascript to make the interaction between my website and Google Drive.

I find out some exemple like this one : https://mashe.hawksey.info/2015/10/google-sheets-as-a-database-authenticated-insert-with-apps-script-using-execution-api/ I do be able to reproduce this example but it use an Auth authentification.

I would like to use Google Apps Script Execution API without Auth authentification but with simple API keys.

Is it possible ? And do you have an example to illustrate this.

Thank you for your help,

解决方案

Yes you can do that. Check this guide about web deployment using apps script. You just need to run the web app as your own user (parameter Execute the app as). But you will only be able to get access to your own google Drive which may not be that useful. If you want to access others' people Drive then you must run the web app as the current user but this will prompt for permissions (the first time the user access your application).

这篇关于使用API​​密钥和Javascript使用Google Apps脚本执行API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆