• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

mhawksey/Example-Google-Apps-Script-Execution-API-integration-in-Chrome-Extensio ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

mhawksey/Example-Google-Apps-Script-Execution-API-integration-in-Chrome-Extension

开源软件地址:

https://github.com/mhawksey/Example-Google-Apps-Script-Execution-API-integration-in-Chrome-Extension

开源编程语言:

JavaScript 67.5%

开源软件介绍:

Using the Google Apps Script Execution API in Chrome Extensions

This is a sample Google Chrome extension that demonstrates using the Chrome Identity API to authorize access to use the Google Apps Script Execution API. If you are not familiar with these services here:

Chrome Extensions and Content Security

Extensions allow you to add functionality to Chrome without diving deeply into native code. You can create new extensions for Chrome with those core technologies that you're already familiar with from web development: HTML, CSS, and JavaScript.

If you have developed applications using the Execution API with HTML/JavaScript you've probably used Google client library to do this. As Google states "while not strictly necessary, can greatly assist in handling OAuth for the application". In the case of Chrome Extensions the use of client libraries can be problematic. For example, when developing my first Chrome Extension I encountered a number of errors similar to:

Refused to load the script 'https://apis.google.com/js/client.js' because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:"

There are solutions for these on Stack Overflow (like this one), but I struggled to get those to work. As the Execution API relies on the user having a Google Account using the Chrome Identity API appears to be a better solution.

Testing it out

The quick and easy to get the code running on your computer.

  1. Download the source code.
  2. Load the extension in developer mode.
  3. Open the Execution API Example popup
  4. Authenticate extension and the Call Execution API

Execution API Example popup

How it works

When the popup is opened the extension silently checks/requests a authentication token. If a token is present the authenticate button is disabled, otherwise the button is enabled and when clicked starts the interactive authentication flow.

Notes on setting up

For notes on setup and usage read this blog post

Acknowledgements

This project is based on:




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap