pimutils / vdirsyncer

📇 Synchronize calendars and contacts.

Home Page:https://vdirsyncer.pimutils.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to discover collections for google_contacts

axet opened this issue · comments

commented

Before you submit bug reports: https://vdirsyncer.pimutils.org/en/stable/contributing.html

Things to include in your bugreport:

  • version 0.19.0
  • Your Python 3.11.2
  • Debian 12
[general]
status_path="~/.config/vdirsyncer/status"

[storage local_calendar]
type = "filesystem"
path = "~/encfs/cfg/calendar/"
fileext = ".ics"

[storage local_contacts]
type = "filesystem"
path = "~/encfs/cfg/contacts"
fileext = ".vcf"

[storage google_calendar]
type = "google_calendar"
token_file = "~/.config/vdirsyncer/google_token"
client_id = "8888"
client_secret = "9999"

[storage google_contacts]
type = "google_contacts"
token_file = "~/.config/vdirsyncer/google_token"
client_id = "8888"
client_secret = "9999"

[pair calendar]
a = "google_calendar"
b = "local_calendar"
collections = ["from a", "from b"]
metadata = ["color"]

[pair contacts]
a = "google_contacts"
b = "local_contacts"
collections = ["from a", "from b"]
metadata = ["displayname"]

debug

Discovering collections for pair contacts
debug: ====================
debug: PROPFIND https://www.googleapis.com/.well-known/carddav
debug: {'User-Agent': '888888', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '1'}
debug: b'\n    <propfind xmlns="DAV:">\n        <prop>\n            <resourcetype />\n        </prop>\n    </propfind>\n    '
debug: Sending request...
debug: 403
debug: <CIMultiDictProxy('WWW-Authenticate': 'Bearer realm="https://accounts.google.com/", error="insufficient_scope", scope="https://www.googleapis.com/auth/carddav"', 'Vary': 'Origin', 'Vary': 'X-Origin', 'Vary': 'Referer', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Encoding': 'gzip', 'Date': 'Wed, 10 Jan 2024 11:10:41 GMT', 'Server': 'ESF', 'Cache-Control': 'private', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'Transfer-Encoding': 'chunked')>
debug: <StreamReader 483 bytes eof>
debug: Given URL is not a homeset URL
debug: ====================
debug: PROPFIND https://www.googleapis.com/.well-known/carddav
debug: {'User-Agent': '888888', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '0'}
debug: b'\n        <propfind xmlns="DAV:">\n            <prop>\n                <current-user-principal />\n            </prop>\n        </propfind>\n        '
debug: Sending request...
debug: 403
debug: <CIMultiDictProxy('WWW-Authenticate': 'Bearer realm="https://accounts.google.com/", error="insufficient_scope", scope="https://www.googleapis.com/auth/carddav"', 'Vary': 'Origin', 'Vary': 'X-Origin', 'Vary': 'Referer', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Encoding': 'gzip', 'Date': 'Wed, 10 Jan 2024 11:10:41 GMT', 'Server': 'ESF', 'Cache-Control': 'private', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'Transfer-Encoding': 'chunked')>
debug: <StreamReader 483 bytes eof>
debug: Trying out well-known URI
debug: ====================
debug: PROPFIND https://www.googleapis.com/.well-known/carddav
debug: {'User-Agent': '88888', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '0'}
debug: b'\n        <propfind xmlns="DAV:">\n            <prop>\n                <current-user-principal />\n            </prop>\n        </propfind>\n        '
debug: Sending request...
debug: 403
debug: <CIMultiDictProxy('WWW-Authenticate': 'Bearer realm="https://accounts.google.com/", error="insufficient_scope", scope="https://www.googleapis.com/auth/carddav"', 'Vary': 'Origin', 'Vary': 'X-Origin', 'Vary': 'Referer', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Encoding': 'gzip', 'Date': 'Wed, 10 Jan 2024 11:10:41 GMT', 'Server': 'ESF', 'Cache-Control': 'private', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'Transfer-Encoding': 'chunked')>
debug: <StreamReader 483 bytes eof>
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 263, in _print_collections
debug:     discovered = await get_discovered()
debug:                  ^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 176, in get_self
debug:     self._discovered = await self._discover()
debug:                        ^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 185, in _discover
debug:     return handle_storage_init_error(self._cls, self._config)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 181, in _discover
debug:     discovered = await aiostream.stream.list(self._cls.discover(**self._config))
debug:                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/aiostream/core.py", line 32, in wait_stream
debug:     async for item in streamer:
debug:   File "/usr/lib/python3/dist-packages/aiostream/stream/aggregate.py", line 71, in list
debug:     async for item in streamer:
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 487, in discover
debug:     async for collection in d.discover():
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 274, in discover
debug:     for c in await self.find_collections():
debug:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 235, in find_collections
debug:     self._find_collections_impl(await self.find_home())
debug:                                 ^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 209, in find_home
debug:     url = await self.find_principal()
debug:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 174, in find_principal
debug:     return await self._find_principal_impl(self._well_known_uri)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 187, in _find_principal_impl
debug:     response = await self.session.request(
debug:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/google.py", line 68, in request
debug:     return await super().request(method, path, **kwargs)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 416, in request
debug:     return await http.request(method, url, session=session, **more)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/http.py", line 153, in request
debug:     response.raise_for_status()
debug:   File "/usr/lib/python3/dist-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
debug:     raise ClientResponseError(
warning: Failed to discover collections for google_contacts, use `-vdebug` to see the full traceback.
local_contacts:
debug: ====================
debug: PROPFIND https://www.googleapis.com/.well-known/carddav
debug: {'User-Agent': '8888888', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '1'}
debug: b'\n    <propfind xmlns="DAV:">\n        <prop>\n            <resourcetype />\n        </prop>\n    </propfind>\n    '
debug: Sending request...
debug: 403
debug: <CIMultiDictProxy('WWW-Authenticate': 'Bearer realm="https://accounts.google.com/", error="insufficient_scope", scope="https://www.googleapis.com/auth/carddav"', 'Vary': 'Origin', 'Vary': 'X-Origin', 'Vary': 'Referer', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Encoding': 'gzip', 'Date': 'Wed, 10 Jan 2024 11:10:41 GMT', 'Server': 'ESF', 'Cache-Control': 'private', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'Transfer-Encoding': 'chunked')>
debug: <StreamReader 483 bytes eof>
debug: Given URL is not a homeset URL
debug: ====================
debug: PROPFIND https://www.googleapis.com/.well-known/carddav
debug: {'User-Agent': '8888', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '0'}
debug: b'\n        <propfind xmlns="DAV:">\n            <prop>\n                <current-user-principal />\n            </prop>\n        </propfind>\n        '
debug: Sending request...
debug: 403
debug: <CIMultiDictProxy('WWW-Authenticate': 'Bearer realm="https://accounts.google.com/", error="insufficient_scope", scope="https://www.googleapis.com/auth/carddav"', 'Vary': 'Origin', 'Vary': 'X-Origin', 'Vary': 'Referer', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Encoding': 'gzip', 'Date': 'Wed, 10 Jan 2024 11:10:42 GMT', 'Server': 'ESF', 'Cache-Control': 'private', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'Transfer-Encoding': 'chunked')>
debug: <StreamReader 483 bytes>
debug: Trying out well-known URI
debug: ====================
debug: PROPFIND https://www.googleapis.com/.well-known/carddav
debug: {'User-Agent': '88888', 'Content-Type': 'application/xml; charset=UTF-8', 'Depth': '0'}
debug: b'\n        <propfind xmlns="DAV:">\n            <prop>\n                <current-user-principal />\n            </prop>\n        </propfind>\n        '
debug: Sending request...
debug: 403
debug: <CIMultiDictProxy('WWW-Authenticate': 'Bearer realm="https://accounts.google.com/", error="insufficient_scope", scope="https://www.googleapis.com/auth/carddav"', 'Vary': 'Origin', 'Vary': 'X-Origin', 'Vary': 'Referer', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Encoding': 'gzip', 'Date': 'Wed, 10 Jan 2024 11:10:42 GMT', 'Server': 'ESF', 'Cache-Control': 'private', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000', 'Transfer-Encoding': 'chunked')>
debug: <StreamReader 483 bytes eof>
error: Unknown error occurred: 403, message='Forbidden', url=URL('https://www.googleapis.com/.well-known/carddav')
error: Use `-vdebug` to see the full traceback.
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/__init__.py", line 32, in inner
debug:     f(*a, **kw)
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/__init__.py", line 222, in discover
debug:     asyncio.run(main())
debug:   File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
debug:     return runner.run(main)
debug:            ^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
debug:     return self._loop.run_until_complete(task)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
debug:     return future.result()
debug:            ^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/__init__.py", line 214, in main
debug:     await discover_collections(
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/tasks.py", line 92, in discover_collections
debug:     rv = await collections_for_pair(pair=pair, **kwargs)
debug:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 97, in collections_for_pair
debug:     rv = await aiostream.stream.list(
debug:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/aiostream/core.py", line 32, in wait_stream
debug:     async for item in streamer:
debug:   File "/usr/lib/python3/dist-packages/aiostream/stream/aggregate.py", line 71, in list
debug:     async for item in streamer:
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 210, in expand_collections
debug:     collections = await get_a_discovered()
debug:                   ^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 176, in get_self
debug:     self._discovered = await self._discover()
debug:                        ^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 185, in _discover
debug:     return handle_storage_init_error(self._cls, self._config)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/cli/discover.py", line 181, in _discover
debug:     discovered = await aiostream.stream.list(self._cls.discover(**self._config))
debug:                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/aiostream/core.py", line 32, in wait_stream
debug:     async for item in streamer:
debug:   File "/usr/lib/python3/dist-packages/aiostream/stream/aggregate.py", line 71, in list
debug:     async for item in streamer:
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 487, in discover
debug:     async for collection in d.discover():
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 274, in discover
debug:     for c in await self.find_collections():
debug:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 235, in find_collections
debug:     self._find_collections_impl(await self.find_home())
debug:                                 ^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 209, in find_home
debug:     url = await self.find_principal()
debug:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 174, in find_principal
debug:     return await self._find_principal_impl(self._well_known_uri)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 187, in _find_principal_impl
debug:     response = await self.session.request(
debug:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/google.py", line 68, in request
debug:     return await super().request(method, path, **kwargs)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/storage/dav.py", line 416, in request
debug:     return await http.request(method, url, session=session, **more)
debug:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
debug:   File "/usr/lib/python3/dist-packages/vdirsyncer/http.py", line 153, in request
debug:     response.raise_for_status()
debug:   File "/usr/lib/python3/dist-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
debug:     raise ClientResponseError(

I only have issue with google contacts carddav, but google calendar caldav with same token works fine.

https://stackoverflow.com/questions/21487706/google-carddav-api-403-error

Saying wrong scope.

commented

You need two different tokens for carddav and caldav and different token paths.