This describes how to migrate from cEzyOauth2 while using the Goa library as described in Oauth2 for Apps Script in a few lines of code (which you should read first for background).
The library, cGoa, is available under this project key.



Goa is compatible with cEzyOauth2, and can use existing credentials and tokens that have been created by cEzyOauth2. The redirect URI will have changed and will need to be updated in the app dashboard as advised by the consent dialog when you get one.


The patterns for Goa are much simpler. I converted gasGit, which needs 2 token flows (one for drive, another for github)  in a few minutes. There was no need to reinitialize the credentials since they are the same structure. After deleting all the ezyoauth2 stuff,  the doGet pattern became. For more details on multiple Oauth2 see Multiple oAuth2 authentication packages
function doGet(e) {

  // i need these two
  var fs = ['script','gasgit'] ;

  // if we are being called back to get consent then the name of the package will be in the parameters
  var name = cGoa.GoaApp.getName(e);
  if(name) {
    var goa = cGoa.GoaApp.createGoa(name,PropertiesService.getScriptProperties()).execute(e); 
    // renter for consent
    if (goa.needsConsent()) {
      return goa.getConsent();
  // if we get here then we look through each one to see if any more consent is needed
  for (var i = 0; i < fs.length ; i++ ) {
    var goa = cGoa.GoaApp.createGoa(fs[i],PropertiesService.getScriptProperties()).execute(); 
    if (goa.needsConsent()) {
      return goa.getConsent();
    if (!goa.hasToken()) throw 'something went wrong with goa - did you check if consent was needed?';
   return HtmlService.createHtmlOutput ('all tokens created for each of ' + fs.join(','))


Next I needed a new version of getAccessToken() which I had written to pick up tokens inside the gasGit code.

function getAccessToken(packageName) {
  return  cGoa.GoaApp.createGoa(packageName , PropertiesService.getScriptProperties() ).execute().getToken();

Finally, I rewrote the setOneTimeProperties – although not needed for this, they may be in the future. Once I run these and provoke a consent dialog, I’ll need to update the redirect URI in the dev console.

function oneTimeSetProperties () {

  cGoa.GoaApp.setPackage (propertyStore , { 
    clientId : "",
    clientSecret : "CH1l3wW6lZofc0jX2OR6iBvi",
    scopes : cGoa.GoaApp.scopesGoogleExpand (['drive','drive.scripts']),
    service: 'google',
    packageName: 'script'

  cGoa.GoaApp.setPackage (propertyStore , { 
    clientId : "xxx",
    clientSecret : "xxx",
    scopes : [
    service: 'github',
    packageName: 'gasgit'


For more like this, see OAuth2 for Apps Script in a few lines of code

Why not join our forum, follow the blog or follow me on Twitter to ensure you get updates when they are available.