seanfarley / emacs-bitwarden

Emacs Bitwarden command wrapper.
GNU General Public License v3.0
50 stars 13 forks source link

Symbol’s value as variable is void: print-message #10

Closed jsilve24 closed 2 years ago

jsilve24 commented 2 years ago

Thank you for putting this package together. I am trying to set this package up but I am getting the message

Symbol’s value as variable is void: print-message [2 times]

Whenever I try to login.

Here is my configuration.

(setq bitwarden-user "foo@gmail.com")
(setq bitwarden-automatic-unlock
      (let* ((matches (auth-source-search :user "foo@gmail.com"
                      :host "bitwarden.foo"
                      :require '(:secret)
                      :max 1))
         (entry (nth 0 matches)))
    (plist-get entry :secret)))
(bitwarden-auth-source-enable)

I also have a line in my authinfo that reads machine bitwarden.foo login foo@gmail.com password XXX

seanfarley commented 2 years ago

Thanks for the report!

Let's try a few things first. Can you evaluate your let statement and get the expected result?

(let* ((matches (auth-source-search :user "foo@gmail.com"
                      :host "bitwarden.foo"
                      :require '(:secret)
                      :max 1))
         (entry (nth 0 matches)))
    (plist-get entry :secret))

Second, can you log in via the command line (without any emacs) and query your passwords?

jsilve24 commented 2 years ago

So yes to the first question. The let statement works as expected.

Regarding the command line (first I feel silly not already trying that) -- yes BUT I also needed to pass an API key client_secret which I found by following these instructions: https://bitwarden.com/help/personal-api-key/

I notice that in my configuration password XXX is my password but there is nowhere that I am passing the API key...

jsilve24 commented 2 years ago

On the command line the following call logs me in

bw login foo@gmail.com 'XXX' --code YYY

seanfarley commented 2 years ago

Hmm, did the command line change and I not notice it yet? Let me see if there are any updates and try on my end. You shouldn't need the api key, by the way

seanfarley commented 2 years ago

I haven't been able to reproduce this so it's been a challenge to see what's wrong :-(

jsilve24 commented 2 years ago

Ya sorry I have not been much help. Laptop died and tried to recover.

Sent From My Mobile Device


From: Sean Farley @.> Sent: Monday, April 18, 2022 4:59:34 PM To: seanfarley/emacs-bitwarden @.> Cc: Justin Silverman @.>; Author @.> Subject: Re: [seanfarley/emacs-bitwarden] Symbol’s value as variable is void: print-message (Issue #10)

I haven't been able to reproduce this so it's been a challenge to see what's wrong :-(

— Reply to this email directly, view it on GitHubhttps://github.com/seanfarley/emacs-bitwarden/issues/10#issuecomment-1101762871, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADOORSXT3HER3RLBLZDGG3VFXELNANCNFSM5TK52W6A. You are receiving this because you authored the thread.Message ID: @.***>

seanfarley commented 2 years ago

I see a few spots in the code where print-message could be nil. Could you try running toggle-debug-on-error and get a backtrace next time this happens?

jsilve24 commented 2 years ago

Hi @seanfarley Sorry for the delay. Finally got my new laptop up and running.

I found this issue that is of relevance and explains the API key client_secret issues: https://github.com/bitwarden/cli/issues/383 it looks like this is a new-ish issue that is here to stay. Would likely be good to build in ability to pass API client_secret to emacs-bitwarden.

jsilve24 commented 2 years ago

And here is the backtrace from running bitwarden-login

Debugger entered--Lisp error: (void-variable print-message) (bitwarden--login-proc-filter proc string print-message) (lambda (proc string) (bitwarden--login-proc-filter proc string print-message))(# "? Additional authentication required.\nAPI key clie...")

seanfarley commented 2 years ago

Aha, thanks for figuring out the hard part! Is this only happening for non-self-hosted servers? For example, I self-host the rust port of the bitwarden server and haven't run into this.

jsilve24 commented 2 years ago

That would be my guess but I am not sure. But reading through the linked issue that would be a solid guess

Sent From My Mobile Device


From: Sean Farley @.> Sent: Monday, April 25, 2022 4:55:25 PM To: seanfarley/emacs-bitwarden @.> Cc: Justin Silverman @.>; Author @.> Subject: Re: [seanfarley/emacs-bitwarden] Symbol’s value as variable is void: print-message (Issue #10)

Aha, thanks for figuring out the hard part! Is this only happening for non-self-hosted servers? For example, I self-host the rust port of the bitwarden server and haven't run into this.

— Reply to this email directly, view it on GitHubhttps://github.com/seanfarley/emacs-bitwarden/issues/10#issuecomment-1109031680, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADOORRHETGTJACXYFGDUXDVG4BD3ANCNFSM5TK52W6A. You are receiving this because you authored the thread.Message ID: @.***>