pimutils / pimutils/vdirsyncer

fails to discover gmail calendar validate_token_parameters

Open
#691 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needinfo type: question
Dominant language
Python
Stars
1.9k
Forks
185
Avg merge
11h 49m
Merged PRs (30d)
1

Description

I run vdirsyncer -v DEBUG discover gmail_carddav and get the stacktrace below after pasting the passord given to me by google.

  • vdirsyncer version 0.16.3
  • If applicable, which server software (and which version) you're using: gmail
  • Your Python version : 3.6
  • Your operating system : nixos 17.09 +
  • Your config file: see below
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/cli/discover.py", line 204, in _print_collections
debug:     discovered = get_discovered()
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/cli/discover.py", line 133, in get_self
debug:     return self._discovered
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/utils.py", line 170, in __get__
debug:     obj.__dict__[self.__name__] = result = self.fget(obj)
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/cli/discover.py", line 142, in _discovered
debug:     return handle_storage_init_error(self._cls, self._config)
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/cli/discover.py", line 138, in _discovered
debug:     discovered = list(self._cls.discover(**self._config))
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/storage/dav.py", line 444, in discover
debug:     session, _ = cls.session_class.init_and_remaining_args(**kwargs)
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/storage/dav.py", line 363, in init_and_remaining_args
debug:     return cls(**self_args), remainder
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/storage/google.py", line 46, in __init__
debug:     ui_worker.put(f)
debug:   File "/nix/store/s0zggcf05d555mhww67ni7ldq5s89fw5-python3.6-click-threading-0.4.2/lib/python3.6/site-packages/click_threading/__init__.py", line 130, in put
debug:     return future.result()
debug:   File "/nix/store/166s7l3yjqfc8dj5hfqjb09dbfvp1850-python3-3.6.3/lib/python3.6/concurrent/futures/_base.py", line 432, in result
debug:     return self.__get_result()
debug:   File "/nix/store/166s7l3yjqfc8dj5hfqjb09dbfvp1850-python3-3.6.3/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
debug:     raise self._exception
debug:   File "/nix/store/s0zggcf05d555mhww67ni7ldq5s89fw5-python3.6-click-threading-0.4.2/lib/python3.6/site-packages/click_threading/__init__.py", line 115, in run
debug:     result = func()
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/storage/google.py", line 45, in <lambda>
debug:     f = lambda: self._init_token(token_file, client_id, client_secret)
debug:   File "/nix/store/49zh3lxkh2rw526qahhs4bpa1d6vs999-vdirsyncer-0.16.3/lib/python3.6/site-packages/vdirsyncer/storage/google.py", line 98, in _init_token
debug:     client_secret=client_secret,
debug:   File "/nix/store/yk1h9s38b14dxjprd9b12bw6s12v0wk3-python3.6-requests-oauthlib-0.8.0/lib/python3.6/site-packages/requests_oauthlib/oauth2_session.py", line 244, in fetch_token
debug:     self._client.parse_request_body_response(r.text, scope=self.scope)
debug:   File "/nix/store/lbyr77krprq509nf42kacinmyn32k9y0-python3.6-oauthlib-2.0.0/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 409, in parse_request_body_response
debug:     self.token = parse_token_response(body, scope=scope)
debug:   File "/nix/store/lbyr77krprq509nf42kacinmyn32k9y0-python3.6-oauthlib-2.0.0/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 376, in parse_token_response
debug:     validate_token_parameters(params)
debug:   File "/nix/store/lbyr77krprq509nf42kacinmyn32k9y0-python3.6-oauthlib-2.0.0/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 383, in validate_token_parameters
debug:     raise_from_error(params.get('error'), params)
debug:   File "/nix/store/lbyr77krprq509nf42kacinmyn32k9y0-python3.6-oauthlib-2.0.0/lib/python3.6/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 325, in raise_from_error
debug:     raise cls(**kwargs)
warning: Failed to discover collections for gmail_remote_carddav, use `-vdebug` to see the full traceback.

and here is the relevant config

[pair gmail_carddav]
a = "gmail_local_carddav"
b = "gmail_remote_carddav"
# or vimdiff
collections = ["from a", "from b"]
conflict_resolution = ["command", "nvim -d"]


[storage gmail_local_carddav]
type = "filesystem"
path.fetch = ["command", "sh", "-c", "echo $XDG_DATA_HOME/contacts"]
fileext = ".vcf"

[storage gmail_remote_carddav]
type = "google_contacts"
client_id= "XXXXXX.apps.googleusercontent.com"
client_secret.fetch = ["command", "keyring", "get", "gmail", "client_secret"]
token_file.fetch = ["command", "sh", "-c", "echo $XDG_CACHE_HOME/vdirsyncer/gmail_token"]
# }}}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the vdirsyncer -v DEBUG discover gmail_carddav command using the supplied configuration, then start with vdirsyncer/storage/google.py and the discovery path in vdirsyncer/cli/discover.py. Trace the OAuth failure through the reported stack trace and verify that discovery completes or reports a clear actionable error instead of failing at validate_token_parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.