kidd / org-gcal.el

Org sync with Google Calendar. (active maintained project as of 2019-11-06)
435 stars 47 forks source link

Only update existing events but no new events #171

Open YujiShen opened 2 years ago

YujiShen commented 2 years ago

After manually requesting a new sync token and running for few days, it will not fetch any new event when run org-gcal-fetch. It can still update existing events if there is update. I have to clear the token and request a new one.

I think the request token is not expired otherwise it will give error and will not update existing events, but why it does not fetch new events?

telotortium commented 2 years ago

It should fetch new events - that's strange. How did you configure org-gcal?

YujiShen commented 2 years ago

Thanks! Here is my config:

  ;; Google Calendar Sync
  (require 'org-gcal)
  (setq org-gcal-client-id "..."
        org-gcal-client-secret "..."
        org-gcal-fetch-file-alist '(("personal@gmail.com" .  "~/org/gtd/gcal.org")
                                    ("work@gmail.com" .  "~/org/gtd/gcal-work.org"))
        ;; org-gcal-recurring-events-mode 'nested
        org-gcal-auto-archive t
        org-gcal-down-days 14
        org-gcal-up-days 1)

Here is part of messages when I run org-gcal-fetch:

Events synced in
/Users/yuji/org/gtd/gcal.org_archive
Completed syncing events in buffer.
Events synced in
/Users/yuji/org/gtd/gcal.org_archive
Finding :entry-id: locations (1/21 files): /Users/yuji/org/gtd/gcal.org
....
21 files scanned, 4 files contain IDs, and 169 :entry-id: IDs found.
[error] request--callback: peculiar error: 401
[error] request-default-error-callback: https://www.googleapis.com/calendar/v3/calendars/work@gmail.com/events?access_token=ya29.a0ARrdaM9kDIr5_L3T6ibtL0MfuLpe1Y5Xa049lgZ3L2TJtBkQB7UJdVd8kUYRLDzU-ZXaeu79qK3nUrMJ-IVkZ0Mn0rOkFSGkKzHbx-QfDfo5GkmU9ONdQcnhGSZf9WI1fKUidaB9jKowVfQ4ARopU2hmKFw88A&singleEvents=True&syncToken=CNC8zoD5-fMCENC8zoD5-fMCGAEgzvS1wQE%3D error
[error] request--callback: peculiar error: 401
[error] request-default-error-callback: https://www.googleapis.com/calendar/v3/calendars/personal@gmail.com/events?access_token=ya29.a0ARrdaM9kDIr5_L3T6ibtL0MfuLpe1Y5Xa049lgZ3L2TJtBkQB7UJdVd8kUYRLDzU-ZXaeu79qK3nUrMJ-IVkZ0Mn0rOkFSGkKzHbx-QfDfo5GkmU9ONdQcnhGSZf9WI1fKUidaB9jKowVfQ4ARopU2hmKFw88A&singleEvents=True&syncToken=CLi24fij_fMCELi24fij_fMCGAUg48zTwQE%3D error
OAuth token expired. Now trying to refresh-token
Received HTTP 401
OAuth token expired. Now trying to refresh-token [2 times]
Received HTTP 401
OAuth token expired. Now trying to refresh-token

It does not fetch events after 11/15 for me. I think I requested a new token few days ago.

YujiShen commented 2 years ago

Similar to https://github.com/kidd/org-gcal.el/issues/133, he solved it by requesting a new token, but I think this should not happen (manually clear and request new token is not necessary) if set up correctly.