How to add a Google API provider
What is a provider?
Providers contain the connection details to external platforms. A provider only needs to be set up once and can then be used when creating tiles on a dashboard.
There are two types of integrations and therefore providers:
generic Web API providers that can connect to any REST API
dedicated providers that connect to a specific external platform or database (SQL, ServiceNow, Azure Active App Insights, Elasticsearch, etc.)
About Google API providers
Adding a particular Google API provider is a one-time configuration task, and once you have that Google API provider configured you can use it with multiple tiles. The instructions below use the example of the Google Analytics API, but can be used to create providers for other Google REST APIs.
Adding a Google API provider in Dashboard Server
1. Add a new provider in Dashboard Server Community Edition
In Dashboard Server navigate to the right-hand menu ☰ > system > Integrations
Under Integrations click Web API
Click on the authentication type OAuth
In the service name box type in a suitable name for this provider. This name is used to create a URL so it is best to avoid spaces and non-alphanumeric characters., e.g. GoogleAnalytics.
Leave the grant type as authorization code
The base URL should be
https://www.googleapis.com/
The authorization URL should
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&include_granted_scopes=true
The parameters appended to the authorization URL allow Dashboard Server to continue to access the API after the first hour. Without them Dashboard Server can't reauthorize the provider automatically after the first token has expired. access_type=offline - requests that the API return a refresh token to keep the connection alive. The token expires every hour and without a refresh token, you have to manually reauthorize the provider each time. include_granted_scopes=true - allows the refreshed token to have the same permissions as the original request when the user was present.
The token URL should be
https://oauth2.googleapis.com/token
At this point we need to save the provider and follow the next steps to obtain a client ID and secret from the Google Developer Console, after which we will return to complete these provider details.
Click save to save the provider.
Copy the redirect url displayed. This will be used in the next section.
2. Configure the Google Developer Console
- Visit the Google Developer Console
- Create a new project as required.
- Select Create Credentials > OAuth Client ID
- Select Web Application
Enter the following:
Name: This can be anything
Authorized JavaScript origins: Should be the hostname of your SquaredUp server including the http/https
Authorized Redirect URIs: Should be the redirect url copied from Dashboard Server right-hand menu ☰ > system > web api. It will be your Dashboard Server instance followed by
/ext-core-webapi/callback/GoogleAPIProvider
whereGoogleAPIProvider
is the name of the provider you created.For example:
https://SquaredUpServer/SquaredUpv5/ext-core-webapi/callback/GoogleAnalytics
Where
SquaredUpServer
is the name of the server where Dashboard Server is installed.- Click save/create
- Copy the client ID and secret to use in the next section.
3. Complete the provider setup in Dashboard Server
In Dashboard Server navigate to the right-hand menu ☰ > system > Integrations
- Click on the provider you created earlier to edit it.
- Paste in the client id and secret copied from the Google Developer Console.
- Paste in the relevant authorization scope from OAuth 2.0 Scopes for Google APIs. For example, for Google Analytics it should be the URL scope listed for 'View your Google Analytics data' which is
https://www.googleapis.com/auth/analytics.readonly
- Click save. You will be redirected to Google to login and authorize and then back to Dashboard Server.
If the configuration is correct then you will see a green tick.
If the provider is not authorized it could be that some of the provider configuration is incorrect (for example the username, password, secret etc), or if you use a proxy it could be that the proxy is not configured. See How to configure Dashboard Server to use a proxy
You can now add Web API tiles using this Google API provider, see How to use the Web API tile with Google APIs, such as Google Analytics