Created
October 4, 2019 14:49
-
-
Save rhyskentish/4a2c94bd88eb814c28a80c00d67f189f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* namespace to deal with oauth | |
* @namespace Oauth | |
*/ | |
var Goth = (function(ns) { | |
/** | |
* get a goa or fail | |
* @param {string} packageName the package name | |
* @param {PropertiesService} [props=ScriptProperties] | |
* @return {Goa} a goa | |
*/ | |
ns.getGoa = function (packageName,props) { | |
return cGoa.GoaApp.createGoa( | |
packageName, | |
props || PropertiesService.getScriptProperties() | |
).execute(); | |
} | |
/** | |
* get a token or fail | |
* @param {string} packageName the package name | |
* @param {PropertiesService} [props=ScriptProperties] | |
* @return {Goa} a goa | |
*/ | |
ns.getToken = function (packageName,props) { | |
var goa = ns.getGoa (packageName, props); | |
if (!goa.hasToken()) { | |
throw 'no token retrieved'; | |
} | |
return goa.getToken(); | |
} | |
return ns; | |
}) (Goth || {}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment