项目作者: laplab

项目描述 :
👔 OAuth2 for Google Apps Script
高级语言: JavaScript
项目地址: git://github.com/laplab/gas-oauth2.git
创建时间: 2015-01-30T13:26:42Z
项目社区:https://github.com/laplab/gas-oauth2

开源协议:

下载


" class="reference-link">OAuth2 lib for Google Apps Script Unmaintained

Represents OAuth2 object that provides several methods for OAuth2 Google authentication.

Methods

OAuth2.auth(event)

If event is not provided returns auth link else finishes auth process with getting the token.
If process is not finished or error has occured returns false. All steps of process are logged with Logger app.

Example

  1. function doGet(e) {
  2. // scopes you want get access to
  3. var scopes = [
  4. 'https://www.googleapis.com/auth/glass.timeline',
  5. 'https://www.googleapis.com/auth/glass.location',
  6. 'https://www.googleapis.com/auth/userinfo.email',
  7. 'https://www.googleapis.com/auth/userinfo.profile'
  8. ];
  9. var LogIn = new OAuth2('app client id', 'app client password', scopes);
  10. var link = LogIn.auth(e), html = 'You have successfully logged in!';
  11. if(link != false)
  12. html = '<a href="'+res+'">Would you like to log in?</a>';
  13. return HtmlService.createHtmlOutput('<html><body>'+html+'</body></html>');
  14. }

TODO

Fix token refresh proccess