pimutils / pimutils/vdirsyncer
error: 400, message='Bad Request'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 185
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 1
Description
I'm trying to sync 2 google calendars. When I run vdirsyncer discover calendar, I am asked the following:
warning: No collection "myself1@gmail.com" found for storage gmail2_calendar.
Should vdirsyncer attempt to create it? [y/N]:
Answering Y, I get:
error: 400, message='Bad Request', url=URL('https://apidata.googleusercontent.com/caldav/v2/myself2@gmail.com/myself1@gmail.com')
critical: Unable to find or create collection "myself1@gmail.com" for storage "gmail2_calendar". Please create the collection yourself.
I've tried creating this manually by adding a calendar with the name myself1@gmail.com in myself2's gmail calendar. I have given all the caldav scopes to the oauth consent screen. I see when I run discover that it is indeed accessing my account because I can see it's reading my calendar names. Here's the last line with debug:
debug: Sending request...
debug: 400
debug: <CIMultiDictProxy('Content-Type': 'text/html; charset=UTF-8', 'Referrer-Policy': 'no-referrer', 'Content-Length': '1555', 'Date': 'Sat, 10 Sep 2022 03:46:00 GMT')>
debug: <StreamReader 1555 bytes eof>
error: 400, message='Bad Request', url=URL('https://apidata.googleusercontent.com/caldav/v2/myself2@gmail.com/myself1@gmail.com')
critical: Unable to find or create collection "myself1@gmail.com" for storage "gmail2_calendar". Please create the collection yourself.
I'm running the version in git using Python 3.10.4 on Ubuntu 22.04.1 LTS
status_path = "~/.vdirsyncer/status/"
[pair calendar]
a = "gmail1_calendar"
b = "gmail2_calendar"
collections = ["from a", "from b"]
metadata = ["color"]
[storage gmail1_calendar]
type = "google_calendar"
token_file = "~/.vdirsyncer/gmail1_token"
client_id = "redacted"
client_secret = "redacted"
[storage gmail2_calendar]
type = "google_calendar"
token_file = "~/.vdirsyncer/gmail2_token"
client_id = "redacted"
client_secret = "redacted"
I'm using the same client_id and client_secret for both. It's a little confusing because it's a little difficult to tell which account it's asking credentials for but I have tried deleting the tokens and tried both ways around. I don't think the oauth is the problem at this point.
My example shows 2 gmail accts, but one of them is a google workspace acct, not sure if that makes a difference. Again, the oauth part seems to be working. vdirsyncer is able to read my list of calendars. The problem seems like a permission problem, yet I've added all the scopes I can find that have to do with writing and creating calendar entries.
API | Scope | User-facing description
CalDAV API | .../auth/calendar | See, edit, share, and permanently delete all the calendars you can access using Google Calendar
CalDAV API | .../auth/calendar.readonly | See and download any calendar you can access using your Google Calendar
CalDAV API | .../auth/calendar.app.created | Make secondary Google calendars, and see, create, change, and delete events on them
CalDAV API | .../auth/calendar.events | View and edit events on all your calendars
CalDAV API | .../auth/calendar.events.freebusy | See the availability on Google calendars you have access to
CalDAV API | .../auth/calendar.events.owned | See, create, change, and delete events on Google calendars you own
CalDAV API | .../auth/calendar.events.owned.readonly | See the events on Google calendars you own
CalDAV API | .../auth/calendar.events.public.readonly | See the events on public calendars
CalDAV API | .../auth/calendar.events.readonly | View events on all your calendars
CalDAV API | .../auth/calendar.calendarlist | See, add, and remove Google calendars you’re subscribed to
CalDAV API | .../auth/calendar.calendarlist.readonly | See the list of Google calendars you’re subscribed to
CalDAV API | .../auth/calendar.calendars | See and change the properties of Google calendars you have access to, and create secondary calendars
CalDAV API | .../auth/calendar.calendars.readonly | See the title, description, default time zone, and other properties of Google calendars you have access to
Or maybe vdirsyncer is not naming the remote calendar it's trying to create properly? I have tried creating the calendars manually and vdirsyncer does not see them. I noticed that I can create multiple calendars with the same name! So I think the name of the calendar is probably not the name vdirsyncer is using which is maybe why I can't just manually create a calendar and hope that the names match.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce vdirsyncer discover calendar with the two Google Calendar storages and the reported configuration, then inspect the collection-creation request that produces the 400 URL. Compare the account, collection name, and permissions involved; done means the reported setup either discovers or creates the intended collection, or reports a specific actionable failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100