I'm working on implementing the generation of Google Meet links using ASP.NET. I've enabled the Google Calendar service in GCP, created a Google service account, and set up a Google Workspace account. In the backend, I'm creating a Google Calendar event with an expected time duration. It generates a Google Calendar event link, but when I try to add parameters for generating a Google Meet link to the request body, it returns a bad request error.
Here's an excerpt of the code:
using (var stream = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), "Cre", "cred.json"), FileMode.Open, FileAccess.Read))
{
credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
}
var services = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
var = new Event
{
Summary = "Tecoora Online Meeting",
Location = "Online/Google Meet",
Description = "Discussion with Lawyer",
Creator = new Event.CreatorData()
{
DisplayName = "Tecoora Google Meet",
Email = "PII removed by staff"
},
Organizer = new Event.OrganizerData()
{
DisplayName = "Tecoora Google Meet",
Email = "PII removed by staff"
},
Start = new EventDateTime()
{
DateTimeDateTimeOffset = timeSlot.FromTime,
},
End = new EventDateTime()
{
DateTimeDateTimeOffset = timeSlot.ToTime,
},
ConferenceData = new ConferenceData()
{
CreateRequest = new CreateConferenceRequest()
{
RequestId = Guid.NewGuid().ToString(),
ConferenceSolutionKey = new ConferenceSolutionKey()
{
Type = "hangoutsMeet"
}
}
},
AnyoneCanAddSelf = true,
GuestsCanInviteOthers = true,
GuestsCanModify = true,
GuestsCanSeeOtherGuests = true,
Visibility = "public",
};
var eventRequest = services.Events.Insert(@event, "primary");
if(eventRequest == null)
{
response.Error = "Google Meet Link Generation Issue.";
response.Success = false;
return response;
}
eventRequest.ConferenceDataVersion = 1;
Event createdEvent = await eventRequest.ExecuteAsync();
if(createdEvent == null)
{
response.Error = "Google Meet Link Creation Issue.";
response.Success = false;
return response;
}
I believe the issue might be related to the Google service account setup. Some suggestions on Stack Overflow have directed me to enable Domain Wide Delegation in the Google Workspace account to resolve this issue. However, I can't seem to find the Domain Wide Delegation tab inside the security settings of my Google Workspace account. and I am using super admin account for finding that domain wide delegation setting.
This is a question in the Google Community. Could you help me resolve this issue?
Thank you!