Skip to content

Instantly share code, notes, and snippets.

@rhyskentish rhyskentish/Goth.gs
Created Oct 4, 2019

Embed
What would you like to do?
/**
* 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
You can’t perform that action at this time.