Ruby on rails 如何解决“错误”;Can';t在只读日历上创建事件;从尼拉斯来的?

Ruby on rails 如何解决“错误”;Can';t在只读日历上创建事件;从尼拉斯来的?,ruby-on-rails,Ruby On Rails,我正在Ruby on Rails应用程序中使用nylas。 我使用谷歌作为我在尼拉斯的供应商。我想在谷歌日历中添加一个活动。 在google中进行身份验证后,google将刷新令牌返回给我。我用它将这封邮件添加到nylas。最后,nylas向我发送了一个访问\u令牌 以下几行是我使用的谷歌范围: openid email profile https://www.googleapis.com/auth/userinfo.email https://www.google.com/m8/feeds/

我正在Ruby on Rails应用程序中使用nylas。
我使用谷歌作为我在尼拉斯的供应商。我想在谷歌日历中添加一个活动。
在google中进行身份验证后,google将
刷新令牌
返回给我。我用它将这封邮件添加到nylas。最后,nylas向我发送了一个
访问\u令牌


以下几行是我使用的谷歌范围:

openid
email
profile
https://www.googleapis.com/auth/userinfo.email
https://www.google.com/m8/feeds/
https://www.googleapis.com/auth/userinfo.profile 
https://mail.google.com/  
https://www.googleapis.com/auth/calendar 
https://www.googleapis.com/auth/calendar.events
现在,我想用下面的代码片段向日历中添加一个事件

nylas = Nylas::API.new(app_id: "My_nylas_app_id",app_secret: "My_nylas_app_secret", access_token: "user_access_token")

calendar = nylas.calendars.first()

nylas.events.create(title: "A fun event!", location: "The Party Zone", calendar_id: calendar.id,when: { start_time: Time.now + 60, end_time: Time.now + 120 }).to_h
并且,上述代码段返回以下错误:

D, [2021-05-23T09:49:39.148247 #9070] DEBUG -- : [httplog] Connecting: api.nylas.com:443
D, [2021-05-23T09:49:39.954976 #9070] DEBUG -- : [httplog] Sending: POST http://api.nylas.com:443/events
D, [2021-05-23T09:49:39.955023 #9070] DEBUG -- : [httplog] Data: 
D, [2021-05-23T09:49:39.955071 #9070] DEBUG -- : [httplog] Status: 400
D, [2021-05-23T09:49:39.955096 #9070] DEBUG -- : [httplog] Benchmark: 0.391611 seconds
D, [2021-05-23T09:49:39.955136 #9070] DEBUG -- : [httplog] Response:
{"message":"Can't create events on read_only calendar.","type":"invalid_request_error"}