This describes how to set up new (or examine existing) services using the Goa library as described in Oauth2 for Apps Script in a few lines of code (which you should read first for background).
A service is a OAuth2 process and properties definition. Many OAuth2 providers have slightly different implementations of OAuth2, and of course have different endpoints. Goa provides the concept of 'a named service', where it already knows how to deal with particular providers, and which can be specified in your package by name, without the need to research the details of a specific implementation.
A webapp is available to see which services have so far been implemented for Goa. By default it will show all services and their details, but also takes these parameters.
summary=1 - provide a summary of service names
service=servicename - provide details for 'servicename'
An example of a service definition is given below
To see currently supported services, try the webapp . You can also detect all the services from a script by accessing the cGoa.Service.package object.
|authUrl||The end point from which to get the authentication code|
|tokenUrl||The end point at which to exchange the authentication code for an access token|
|refreshUrl||The end point at which to exchange a refresh token for an access token. For many services this is the same as the tokenUrl|
|accountType||Optional. By default the account type is a regular Oauth web client flow. Aside from the default, the only supported value at the time of writing is 'serviceaccount', which identities that the service shoudl follow the service account flow.|
|accept||Optional. Some services need an accept value in the header. For example, Git hub needs accept: "application/json" to be specified here. Generally speaking this is not required.|
|basic||Optional. Some services (for example reddit) need the client id and secret to be encoded|
|duration|| Optional Some services allow the lifetime of the access token to be specified. For example, Reddit needs this field to be 'permanent' before it will issue a refresh token.|
|defaultDuration||Optional. The default lifetime in seconds of service account tokens.|
Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, All formats are available from O'Reilly, Amazon and all good bookshops. You can also read a preview on O'Reilly