Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jsilve24 opened this issue Apr 13, 2022 · 11 comments · Fixed by #11
Closed

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

jsilve24 opened this issue Apr 13, 2022 · 11 comments · Fixed by #11

Comments

@jsilve24
Copy link
Contributor

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 "[email protected]")
(setq bitwarden-automatic-unlock
      (let* ((matches (auth-source-search :user "[email protected]"
					  :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 [email protected] password XXX

@seanfarley
Copy link
Owner

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 "[email protected]"
					  :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
Copy link
Contributor Author

jsilve24 commented Apr 13, 2022 via email

@jsilve24
Copy link
Contributor Author

On the command line the following call logs me in

bw login [email protected] 'XXX' --code YYY

@seanfarley
Copy link
Owner

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
Copy link
Owner

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

@jsilve24
Copy link
Contributor Author

jsilve24 commented Apr 18, 2022 via email

@seanfarley
Copy link
Owner

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
Copy link
Contributor Author

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: bitwarden/cli#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
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

jsilve24 commented Apr 25, 2022 via email

seanfarley added a commit that referenced this issue May 23, 2022
<p dir="auto"><span class="issue-keyword tooltipped tooltipped-se" aria-label="This pull request closes issue #10.">Fixes</span> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1203413750" data-permission-text="Title is private" data-url="#10" data-hovercard-type="issue" data-hovercard-url="//issues/10/hovercard" href="https://github.com/seanfarley/emacs-bitwarden/issues/10">#10</a></p>
<p dir="auto">This adds two custom variables <code class="notranslate">bitwarden-api-secret-key</code> and <code class="notranslate">bitwarden-api-client-id</code> that have the same interface as the existing <code class="notranslate">bitwarden-automatic-unlock</code>. These are optional but used as the prefered login method if non-nil. I have updated the readme providing guidance on how to obtain an API key and client_id and emphasizing that this approach only need to be used if users are storing their valult on bitwarden servers.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants