Google Workspace Add-Ons
Google workspace addons are server based AppScript code that runs on Google servers producing pages for the Google addon engine. The AppScript code runs in a trusted user context, meaning, your code can trust the user id provided by the addon API.
Most addons are built to provide convenient integrations to a third party system or service right from Gmail or Google calendar, like Customer Relationship Management, Customer Service, Project Management,... and the addon developers often end up developing the same or similar elements of their app:
Implement user management (login/logout/session) which needs to be correlated with an authenticated Google user.
Support one or more 3rd party authorization flows. For example, a user needs to link his or her CRM account, maybe also a non-Google cloud file storage.
Proxy requests to 3rd party API's.
Store various addon configurations for users or organizations.
Offline mailbox access. Often special workers are implemented to run in background when an addon user is offline.
Plus the big challenge with AppScript is that developers have to develop in a web based editor (your online AppScript project) so it could be difficult to mange complex logic especially if you're new to AppScript.
Aurinko aims to provide the necessary backend functionality for these addons so that developers could simplify their AppScript code and to create the best user experiences. Here are the steps to start using Aurinko to simplify your addon development:
Get your developer API keys and put your app's client id into your client code or better pass it from your manifest file as as url parameter.
In most cases you want to have offline mailbox access or ability to access Gmail, Calendar, Contacts API so provision your Google OAuth app registrations.
Because your AppScript code runs on servers in a safe trusted context you can use Aurinko account management API methods with the app id/secret. The simplest way to register the current addon user with your Aurinko app is the following:
Response:
Store userId and userSession in AppScript storage so that your code could verify login status after a reload.
To obtain offline mailbox access use the OAuth2 flow in a popup window, specify userAccount=primary.
Here is how you produce a timestamp and signature:
state:
returnUrl:
Once a user is provisioned your addon can add other secondary accounts using OAuth2 flow in a popup window. Contact us at support@aurinko.io to arrange adding a connector for your system, i.e. {MyCRM}.
Use
userAccount=secondary
,userId
from the the previous step, and sign the request.Upon a successful authentication and authorization an Aurinko account representing your 3rd party API {MyCRM} will be added for the user.
Aurinko implements user sessions for these addons using
X-Aurinko-Session
header so lookup the userSession token you obtained earlier
And use it to check the current user status
The request will return all Aurinko accounts associated with the current user session:
7. Now your addon (or a background worker) can access either Gmail API (through Aurinko's unified API) or the 3rd party API. Specify an account id in the special header X-Aurinko-AccountId
and use Aurinko Email/Calendar/Contact to access those accounts.
Last updated