Google Workspace Configuration for OAuth 2.0
These instructions are provided as a convenience for customers using Google® Workspace® (formerly GSuite®) as an OAuth 2.0 provider. Trihedral has no relationship with Google or it's parent company and makes no claim that the information provided here is the best process to use. The following steps were found to work at the time of writing.
You must be signed in to Google's services with a Workspace® account to use this process. A basic GMail® account will not work.
- Open the Google Cloud Platform (GCP) console in a browser: https://console.cloud.google.com
- If this if your first project, you will be prompted for a name.
Otherwise, open the droplist in the top banner next to "Google Cloud Platform" and n the dialog click "New Project".
- Give the project a suitable name and select "Create".
- Ensure that your new project is selected, as shown in the top bar of the page.
- From the menu select APIs & Services -> Library.
- Use the search field to search for "Apps Script".
- Select the Apps Script API result.
- Select ENABLE.
- From the menu select APIs & Services (looks like a menu header), then OAuth consent screen.
- Select "Internal" and click "CREATE".
- Enter an application name such as "VTScada" for the consent screen.
- Select the "Add scope" button.
- In the list, browse for and select the https://mail.google.com scope.
- Select the ADD button.
- The following configuration options may be set or ignored as you wish:
Support email, Logo, and Changes to the OAuth grant limit.
All the other fields do not apply.
- Select "Save".
- From the menu select "Credentials".
- Select "CREATE CREDENTIALS".
- Select "OAuth client ID".
- For Application type select "Web Application".
- Enter a name such as "VTScada" for your OAuth client.
- Under Authorized redirect URIs select "ADD URI".
- Add URI's as appropriate.
These will be the FQDN Fully Qualified Domain Name's of the VTScada OAuth servers, along with the VTScada OAuth path which is "/vtscada/oauth/return". Do not include the realm name for your application. Do not include the port number unless it is non-standard.
- Make a copy of each URI you create. You will need these later when configuring OAuth within VTScada.
- Select CREATE.
- Copy the Client ID and Client Secret from the next dialog.
The secret must be treated as securely as a password.
- You should now have the following information, to be used when configuring OAuth in VTScada:
|Name in Google||Name in VTScada||Example value|
|--||Authorization Endpoint URL||https://accounts.google.com/o/oauth2/v2/auth|
|--||Token Endpoint URL||https://oauth2.googleapis.com/token|
|--||Revocation Endpoint URL||https://accounts.google.com/o/oauth2/revoke|
|Client ID||Client ID||853894256151-0ahtms1s5hrsqv41ebvrlon09pha3av1.apps.googleusercontent.com|
|Client secret Value||Client Secret||Slb3-e3J2c-UwCzVdBv8-Hadun_374|
|Scopes for Google APIs||Requested Scopes||https://mail.google.com|
|Authorised redirect URIs||Redirect URIs||https://myscada.example.com/vtscada/oauth/return|
- Enable the OAuth 2.0 option in Security -> Administrative options -> Advanced.
- Ensure the appropriate server list has been configured.
(Referring here to a Client / Server Configuration list, not a VTScada Thin Client Server server list.)
An OAuth-specific list may be configured if required. For resilience, two OAuth servers are recommended.
- Open the OAuth 2.0 settings dialog.
Available from either the drop-down security menu in the screen or the Security page of the Application Configuration dialog.
- Create a new Provider by clicking the "+" button under the list of providers.
This enables the data entry fields. Start with the Provider Name, not the list of OAuth2 Providers.
- Set the Provider name to something appropriate, such as "Google".
- Set the Authorization Endpoint URL to: https://accounts.google.com/o/oauth2/v2/auth
- Set the Token Endpoint URL to: https://oauth2.googleapis.com/token
- Set the Revocation Endpoint URL to: https://accounts.google.com/o/oauth2/revoke
- Set the Client ID and Client secret to the values recorded in the early set of steps.
- Set the Refresh Token Lifetime to 15552000
This field is measured in seconds and matches the 6-month token lifetime that is the default for Google.
- Using the Scopes editor (the Pen icon next to the Provider Scopes field), add the following scope: https://mail.google.com/
- Using the Redirect URIs editor set the OAuth Redirect URIs to the Authorized redirect URIs recorded above.
- Create a new Grant by clicking the "+" under the grants list.
- Set the Grant name to something appropriate such as "GMail".
- Set the Grant bearer to the GMail account name of the user that will be running the consent operation.
This must be one of your Workspace accounts. You are strongly advised to create an account that will be used only by VTScada. Do not use your personal account.
- Using the Grant Scopes editor select the https://mail.google.com/ scope.
- Select the Apply button.
- Select the Consent button to grant authority for VTScada to access the designated email account.