kidd / org-gcal.el

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

Password prompt on every sync #217

Closed nshi closed 1 year ago

nshi commented 1 year ago

After the recent updates, I started getting the password prompt on every sync even with plstore-cache-passphrase-for-symmetric-encryption set to t. Any advice on what to check or try? Thanks.

telotortium commented 1 year ago

What code are you using exactly to set this variable? You should use something like

(setq-default plstore-cache-passphrase-for-symmetric-encryption t)
telotortium commented 1 year ago

Also what version of Emacs are you using? The relevant code is ancient, so it shouldn't matter, but just want to check.

nshi commented 1 year ago
(setq-default plstore-cache-passphrase-for-symmetric-encryption t)

This is exactly how I set the variable.

I'm using Emacs 27.1 on Ubuntu. org-gcal version is 20221120.2150.

telotortium commented 1 year ago

How odd. What's in the variable plstore-passphrase-alist (obviously redact your password)?

nshi commented 1 year ago

How odd. What's in the variable plstore-passphrase-alist (obviously redact your password)?

It's set to nil. This might be the issue. It's not remembering the password for some reason.

telotortium commented 1 year ago

That's strange. As long as you successfully enter your password at that prompt, it should save it. The prompt does say "Passphrase for PLSTORE", right?

nshi commented 1 year ago

That might be the problem. It doesn't say for plstore. Here's the popup dialog I get. image

telotortium commented 1 year ago

Yeah, I don't have that. It looks like you have some GTK Emacs, maybe on Ubuntu? I don't know what customizations they made there. They probably want to ensure plstore uses the system password manager. However, I'm not sure how they've installed that support.

I would first try checking "Save in password manager" and see if that helps.

If that doesn't help, try running M-x edebug-defun on plstore-passphrase-callback-function to see if that function is even called. This is the relevant part of the backtrace for me on my computer:

  plstore-passphrase-callback-function
  epg--status-GET_HIDDEN
  epg--process-filter
  epg-wait-for-status
  epg-start-decrypt
  epg-decrypt-string
  plstore--decrypt
  plstore-get
  oauth2-auto--plstore-read

So another workaround is to figure out how to use epg as the plstore backend instead of your system password manager - not ideal, but it will help.

seblemaguer commented 1 year ago

I had the same problem and using "Save in password manager" helped

nshi commented 1 year ago

I tried "Save in password manager", it seems to work temporarily within several minutes of the save. When I try to sync again an hour or two later, it asks for password again.

My issue looks very similar to the one reported here. I tried unsetting the environment variable GPG_AGENT_INFO in my init.el to no avail.

franburstall commented 1 year ago

I am also having this issue and seeing the same dialogue on debian-11 with emacs-28.2 built from source (so no ubuntu customisations present).

Other data points: I have a gpg-agent running and /usr/bin/pinentry points to /usr/bin/pinentry-gnome3.

This is made more unpleasant by the fact that I also run EXWM as my window manager and the pinentry dialogue freezes that until I spam ESC.

seblemaguer commented 1 year ago

@nshi and @franburstall I just realized my pinentry mode variable was set to nil and set it to 'loopback:

(setq epg-pinentry-mode 'loopback)

everything happens in emacs then (no dialog)

franburstall commented 1 year ago

That is helpful: thank you.

On Sat, 10 Dec 2022 at 11:40, Sébastien Le Maguer @.***> wrote:

@nshi https://github.com/nshi and @franburstall https://github.com/franburstall I just realized my pinentry mode variable was set to nil and set it to 'loopback:

(setq epg-pinentry-mode 'loopback)

everything happens in emacs then (no dialog)

— Reply to this email directly, view it on GitHub https://github.com/kidd/org-gcal.el/issues/217#issuecomment-1345245743, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLWERT6NYJKMEN4OSD5CGTWMRT23ANCNFSM6AAAAAASO3PQ3E . You are receiving this because you were mentioned.Message ID: @.***>

nshi commented 1 year ago

@nshi and @franburstall I just realized my pinentry mode variable was set to nil and set it to 'loopback:

(setq epg-pinentry-mode 'loopback)

everything happens in emacs then (no dialog)

Thank you so much, @seblemaguer. This solved the problem.

megodoonch commented 1 year ago

Can I still comment here? I still have this problem (together with the reauthentication in issue #227). I'm running GTK Emacs on Ubuntu, so I guess it has something to do with GPG (PGP??).

This is the relevant part of my .emacs:

(require 'org-gcal)
(setq epg-pinentry-mode 'loopback)
(setenv "GPG_AGENT_INFO")
(setq-default plstore-cache-passphrase-for-symmetric-encryption t)