Description
According to Google Workspace developer documentation docs event object should contain docs.id and docs.title if the https://www.googleapis.com/auth/drive.file scope has been authorized by the user.
However this is not the case in practice when attempting to deploy Google-provided example code for smart chips with the drive.file OAuth scope added. The docs event object only contains matchedUrl and it's missing docs.id and docs.title.
Code
Code from https://github.com/googleworkspace/add-ons-samples/tree/main/python/3p-resources with additional OAuth scope added (https://www.googleapis.com/auth/drive.file) and a print debug statement for event in create_link_preview/main.py
Output
{'commonEventObject': {'hostApp': 'DOCS', 'platform': 'WEB'},
'authorizationEventObject': {'userOAuthToken': 'token1', 'userIdToken': 'token2', 'systemIdToken': token3'},
'docs': {'matchedUrl': {'url': 'https://example.com/?name=123'}}}
Note the last line in the output which only contains the matchedUrl field.
Steps to replicate
- Deploy google-provided example code to Cloud Functions
- Create, install and authorize the google workspace add-on
- Paste a sample link that triggers the extension
- Inspect logs for the deployed cloud function to verify the contents of the event object