Conferencing: How to trigger Calendar actions from OAuth callbacks

11 views
Skip to first unread message

Olamilekan Ib

unread,
Nov 25, 2021, 9:31:00 AM11/25/21
to Google Apps Script Community
## Description
I'm trying to build a conferencing addon for Google calendar that kind of works like Google Meet. It requires authentication so in the `createConference` function, I'm throwing an error of type `ConferenceDataService.ConferenceErrorType.AUTHENTICATION` while attaching an authentication URL. I brought in the [oauth](https://github.com/googleworkspace/apps-script-oauth2) package, defined an authentication function `authCallback` and it seems to work as expected. 

The problem is that I need to trigger `createConference` after the authentication is successful so it can update the calendar event with the conferencing tool. I'm aware that `createConference` needs to return the `dataBuilder` object for the frontend to receive that update, but since authentication is required, I have to return the authentication error so it displays the login button for the user to login. Logging in works successfully so how do I update the conference on Google calendar event with the conferencing tool? 

It's quite unclear from the documentation what needs to happen after the authCallback.

Here's what the auth callback looks like: 

```JavaScript
function authCallback(request) {
  const args = JSON.parse(request.parameter.args);
  const eventData = {
    ...args,
    ...request.parameter,
  };

  create3rdPartyConference(eventData);
  return HtmlService.createHtmlOutput('Success! You can close this window.');
}
```
Currently, what it does is to trigger `create3rdPartyConference` (nothing happens), even after building the conference data and triggering `databuilder.build()`. 
## Additional
- The calendar event isn't created by the time `createConference` is called, but it does pass an `eventId` and getting this event returns 404 since it's not created yet. 
- The end goal here is to take away the login button below and display the actual conferencing tool when authentication is successful and `authCallback` is triggered.


Reply all
Reply to author
Forward
0 new messages