The Classy Rest API uses OAuth2 a little like a Service Account, which means there’s typically no user dialog. It uses a grant type called client_credentials. This is probably the most straightforward of all OAuth2 variants, so it’s a breeze to both setup and use. Goa  supports this kind of OAuth2 flow, and the Classy API has been added as a service.
Goa library is available with this key.


Classy dashboard

Like other APIS, there’s a dashboard at which you need to create an application and get credentials. All you’ll need is a client id and secret

One off function

If you’re familiar with Goa, you’ll know that there is a one off function you create to store your credentials, which can be deleted after running. For Classy it looks like this. Note that I’m using the Script Properties as I’m only going to use these credentials for my own script.
The main points are
  • The id, account and secret come from the classy console
  • I’ve called this particular profile ‘classy’. You can call it what you like.
  • I don’t think there are settable scopes for this API. If there are some introduced at a later date you can add a scopes property.
Once you’ve run this, you’re good to go and you can delete it from your script if you want. It won’t be needed again.

To use

Since there is no user interaction required for this, it’s very simple to initialize. Goa automatically takes care of refreshing tokens when required.
For more like this, see Google Apps Scripts Snippets

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