EzyOauth2 has now been superseded by Goa, so this document is for legacy information. For more information see OAuth2 for Apps Script in a few lines of code. If you are using EzyOauth2, it’s easy to migrate. If you are starting up, consider using Goa instead – it’s easier and has more features.
You’ll notice that Google+ for domains has been implemented as an advanced service for Google Apps Script. This allows you to do lots of things with users in your domain directly from apps script. However the Google+ API is needed to play around with public G+ users. Here’s how to do almost everything with the G+ API from GAS.


We need to do oAuth2. In EzyOauth2 – taking some pain out of Apps Script API authentication, I provided a library to simplify oAuth2. We’ll use that here – you should read that first to see how to set up an application on the Google Console, enable the Google+ v1 API, and get some credentials. Once you have done all that you can set up your credentials in your app with a one time function like this.
You’ll then need to set up your redirect URI and run your doGet() once to get authorized as described in EzyOauth2 – taking some pain out of Apps Script API authentication. You’ll remember from there that we only need to run that once, since a refresh token is stored in your properties and automatically gets a fresh access token when needed.
Here’s your one time doGet() pattern that you need to publish run and add the redirectURI to your cloud console credentials. It’s virtually the same as the one used for the datastore example in EzyOauth2 patterns, except it references the credentials you set up for G+ with setAuthenticationPackage.


Here’s an example of pretty much everything you can do with the API. I haven’t added ‘moments’ to this – that’ll be the subject of a different article.

Take a look at EzyOauth2 – taking some pain out of Apps Script API authentication for more on this

For help and more information join our community,  follow the blog or  follow me on Twitter