Я использую Google Calendar API для обновления моего статуса RSVP, он отлично работает, если это приглашение от Google, но если приглашение является внешним, то выдается следующая ошибка
{
"error": {
"errors": [
{
"domain": "calendar",
"reason": "forbiddenForNonOrganizer",
"message": "The operation can only be performed by the organizer of the event."
}
],
"code": 403,
"message": "The operation can only be performed by the organizer of the event."
}
}
this - это ссылка на API Google, где "посетители []. ResponseStatus" - это свойство, представляющее статус RSVP.
Я работаю с "Ruby on Rails", ниже приведен код для обновления события.
def update_event(event)
auth = set_google_auth(calendar)
@client.update!(auth)
service = Google::Apis::CalendarV3::CalendarService.new
service.authorization = @client
attendees_array = [
{
# This is the authenticated user, where i am trying to update rsvp
"email": "user_one@gmail.com",
"responseStatus": "tentative"
},
{
"email": "other_user@gmail.com"
}
]
google_event = Google::Apis::CalendarV3::Event.new({
...,
'attendees': attendees_array,
...
})
end
и метод set_google_auth
def set_google_auth(calendar)
auth = Hash.new
auth["access_token"] = linked_calendar.access_token
auth["expires_in"] = 3600
auth["token_type"] = "Bearer"
return auth
end
пользователь, который обновляет событие, в настоящее время проходит проверку подлинности с помощью Google, т. Е. Он / она обновляет статус для своего собственного календаря.