stevearc / gkeep.nvim

Google Keep integration for Neovim
MIT License
193 stars 6 forks source link

Unable to login #4

Closed txtyash closed 2 years ago

txtyash commented 2 years ago

Describe the bug Unable to login. After I enter my email, I get the error. I'm not prompted for any password.

To Reproduce Steps to reproduce the behavior:

  1. Run command 'GkeepLogin'
  2. See error:
    Error detected while processing function _gkeep_prompt_close[1]..remote#define#request:
    line    2:
    Error invoking '/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep:function:_gkeep_prompt_
    close' on channel 3 (python3-rplugin-host):
    error caught in request handler '/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep:functi
    on:_gkeep_prompt_close [['yashinde369@gmail.com']]':
    Traceback (most recent call last):
    File "/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", line 44, in d
    return f(self, *args[0])
    File "/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", line 78, in w
    f(self, *args, **kwargs)
    File "/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", line 352, in close_
    prompt
    self._modal.prompt.close(text)
    File "/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/modal/prompt.py", line 66, in c
    lose
    callback(text)
    File "/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", line 78, in w
    f(self, *args, **kwargs)
    File "/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", line 45, in d
    return f(self, *args)
    File "/home/zim/.local/share/nvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", line 612, in cmd_lo
    gin
    token = keyring.get_password("google-keep-token", email)
    File "/home/zim/.local/lib/python3.10/site-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
    File "/home/zim/.local/lib/python3.10/site-packages/keyring/backends/libsecret.py", line 62, in get_password
    items = Secret.password_search_sync(
    gi.repository.GLib.GError: g-dbus-error-quark: The name org.freedesktop.secrets was not provided by any .service files (2)

Expected behavior A clear and concise description of what you expected to happen.

Version information

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

 - Gkeep:

gkeep: health#gkeep#check

gkeep

stevearc commented 2 years ago

Sorry, I'm going to be a little slower and less responsive during the holiday season. From a brief check, it looks like keyring is complaining that it doesn't have a backend. Take a look at that page and see if that makes sense and if you can install any of the secret backends it supports.

Keyring is necessary because we have to store an access token for Google (otherwise you would have to login again every time you use the plugin). I'll see what I can do about making this error message friendlier and more actionable when I get a chance.

stevearc commented 2 years ago

Looking at this again, it seems like keyring is maybe recognizing a backend but is having problems with it. It looks like you're on Arch, are you running headless? Some relevant links I found:

fallenpixel commented 2 years ago

Sorry for bugging you during the holidays. I had some alone time and was redoing my nvim config while reading reddit and stumbled across your package. I'm running kde so it's probably trying and filling to get to kwallet. Will look at the links and report back when I get the opportunity.

stevearc commented 2 years ago

No worries! I hope you find the issue, and let me know if there's anything I could add that would make debugging this easier. At a minimum I'll probably add some additional documentation around keyring.

dittoalex commented 2 years ago

I'm also seeing this behavior with latest commit on MacOS. I installed everything for the first time today and had it working but then it broke and it won't login anymore. I've tried reinstalling and manually cleaning but it won't prompt me for email again, just password.

gkeep: health#gkeep#check

gkeep

  • OK: gkeepapi 0.13.7 installed
  • OK: keyring installed
  • WARNING: Not logged in
  • ADVICE:
  • Try :GkeepLogin
  • INFO: Log file: /Users/user/.cache/nvim/gkeep.log

Debug log excerpts:

==> ./gkeep.log <== DEBUG 2022-04-17 14:39:42,248 [gkeep.plugin] Ignoring method cmd_sync. State State.Uninitialized not allowed DEBUG 2022-04-17 14:39:45,463 [gkeep.plugin] Ignoring method _on_buf_enter. State State.Uninitialized not allowed DEBUG 2022-04-17 14:41:29,357 [gkeep.plugin] Ignoring method cmd_sync. State State.Uninitialized not allowed DEBUG 2022-04-17 14:42:03,778 [gkeep.plugin] Ignoring method cmd_sync. State State.Uninitialized not allowed

stevearc commented 2 years ago

@dittoalex when you say you are also seeing this behavior, does that mean that you're seeing the error posted in the original issue? What happens when you try to log in? It sounds like it's not prompting you for an email (that's expected, and shouldn't be an issue unless you want to change the email), but after you enter your password...is there an error? Does it spin forever? I'll need more information to debug.

If you want to fully reset the state, do a :GkeepLogout and then try logging in again.

dittoalex commented 2 years ago

When I saw the above behavior I did not see an error message like in the original issue, but thought it was being eaten by an exception. It felt like it was spinning forever. I tried logging out about a dozen times in my troubleshooting and kept getting "Cannot perform action while Gkeep is Uninitialized." I again tried logging in tonight, same behavior. The customization process during which gkeep.nvim broke I was following README.MD with a fresh install of nvim dedicated just for gkeep.nvim and the minimum amount in .nvimrc.

It may be that the failures are due to my having too-large notes in Google Keep. For years I've had a bug where the items in my notes would get randomized, and that's what led me to gkeep.nvim. While troubleshooting gkeep.nvim I did another search and found recent support post "Google Keep Notes Checklist items re-arrange / get jumbled in random order for unknown reason" , which seems to be caused by character limits in notes. I spent the weekend paring things out of my notes through the browser, while items were being randomized, and will be moving away from Google Keep.

stevearc commented 2 years ago

Oof, yeah Keep does have some hidden, relatively small character limits in the product. Unfortunately I wouldn't expect gkeepapi to behave any better once you hit that because the behavior becomes undefined. Sorry you're hitting these issues and good luck with finding a replacement!

txtyash commented 2 years ago

@stevearc, the errors I get rn on running GkeepLogin mymail@gmail.com:

Error detected while processing function remote#define#CommandBootstrap[5]..remote#define#request:
line    2:
Error invoking '/home/zim/.local/share/lunarvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep:comman
d:GkeepLogin' on channel 3 (python3-rplugin-host):
error caught in request handler '/home/zim/.local/share/lunarvim/site/pack/packer/start/gkeep.nvim/rplugin/pyt
hon3/gkeep:command:GkeepLogin [['yashinde369@gmail.com']]':
Traceback (most recent call last):
  File "/home/zim/.local/lib/python3.10/site-packages/secretstorage/util.py", line 48, in send_and_get_reply
    raise DBusErrorResponse(resp_msg)
jeepney.wrappers.DBusErrorResponse: [org.freedesktop.DBus.Error.UnknownMethod] ('Object does not exist at path
 “/org/freedesktop/secrets/collection/login”',)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/zim/.local/lib/python3.10/site-packages/secretstorage/collection.py", line 161, in get_default_c
ollection
    return Collection(connection)
  File "/home/zim/.local/lib/python3.10/site-packages/secretstorage/collection.py", line 44, in __init__
    self._collection.get_property('Label')
  File "/home/zim/.local/lib/python3.10/site-packages/secretstorage/util.py", line 67, in get_property
    (signature, value), = self.send_and_get_reply(msg)
  File "/home/zim/.local/lib/python3.10/site-packages/secretstorage/util.py", line 52, in send_and_get_reply
    raise ItemNotFoundException('Item does not exist!') from resp
secretstorage.exceptions.ItemNotFoundException: Item does not exist!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zim/.local/lib/python3.10/site-packages/keyring/backends/SecretService.py", line 61, in get_pref
erred_collection
    collection = secretstorage.get_default_collection(bus)
  File "/home/zim/.local/lib/python3.10/site-packages/secretstorage/collection.py", line 163, in get_default_c
ollection
    return create_collection(connection, 'Default',
  File "/home/zim/.local/lib/python3.10/site-packages/secretstorage/collection.py", line 145, in create_collec
tion
    raise PromptDismissedException('Prompt dismissed.')
secretstorage.exceptions.PromptDismissedException: Prompt dismissed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zim/.local/share/lunarvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", li
ne 80, in w
    f(self, *args, **kwargs)
  File "/home/zim/.local/share/lunarvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", li
ne 46, in d
    return f(self, *args[0])
  File "/home/zim/.local/share/lunarvim/site/pack/packer/start/gkeep.nvim/rplugin/python3/gkeep/plugin.py", li
ne 636, in cmd_login
    token = keyring.get_password("google-keep-token", email)
  File "/home/zim/.local/lib/python3.10/site-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
  File "/home/zim/.local/lib/python3.10/site-packages/keyring/backends/chainer.py", line 51, in get_password
    password = keyring.get_password(service, username)
  File "/home/zim/.local/lib/python3.10/site-packages/keyring/backends/SecretService.py", line 78, in get_pass
word
    collection = self.get_preferred_collection()
  File "/home/zim/.local/lib/python3.10/site-packages/keyring/backends/SecretService.py", line 63, in get_pref
erred_collection
    raise InitError("Failed to create the collection: %s." % e)
keyring.errors.InitError: Failed to create the collection: Prompt dismissed..
stevearc commented 2 years ago

Looking around, it sounds like your system may be missing the "login" keyring? I found several references to this issue with VS Code live share https://github.com/MicrosoftDocs/live-share/issues/219. You can try some of the solutions they listed there.

If you want a very small repro, python -c 'import keyring; keyring.get_password("google-keep-token", "foobar")' should produce the same error. If that command succeeds, gkeep should work. If it fails, gkeep will not be able to work. If the fixes in the link above don't do anything for you, you can try filing an issue on the keyring repo with the minimal repro.

txtyash commented 2 years ago

@stevearc the command failed. I don't think I'd want to deal with this anymore. Feel free to close the issue.

BTW, I hate python. It hasn't given me anything other than problems.