What is a service ?
google: { authUrl: "https://accounts.google.com/o/oauth2/auth", tokenUrl: "https://accounts.Google.Com/o/oauth2/token", refreshUrl: "https://accounts.google.com/o/oauth2/token" }
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.
Custom services
If you have an OAuth2 provider that Goa doesn’t know about, you can simply add it to the cGoa.Service.package along with its properties in the script you need to use it in. If you do create a custom service, then post it on our community and I’ll add it to the library so others can use it too.
cGoa.Service.package.mycustomservice = { authUrl: "https://api.myservice.com/auth", tokenUrl: "https://api.myservice.com/token", refreshUrl: "https://api.myservice.com/refresh" };
and used in credentials package like this.
cGoa.GoaApp.setPackage (propertyStore ,{ clientId: "yy", clientSecret:"xx", scopes : ["all"], service: "mycustomservice", packageName: "mycustompackage" });
Service definition properties.
These are the available properties to define a service.
property | purpose |
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. |