r-lib / keyring

:closed_lock_with_key: Access the system credential store from R
https://keyring.r-lib.org/
Other
196 stars 28 forks source link

Jupyter notebook w/ keyring not working #118

Open itsjimbo opened 2 years ago

itsjimbo commented 2 years ago

Steps to reproduce

Fire up jupyter notebook with R kernel

library(keyring)
kb <- keyring::backend_file$new()
kb$set("svc","blah")
Error: key is not a string (length 1 character)

Traceback:
1. kb$set("svc", "blah")
2. b_file_set(self, private, service, username, keyring)
3. self$keyring_unlock(keyring)
4. b_file_keyring_unlock(self, private, keyring, password)
5. private$set_keyring_pass(password, keyring)
6. b__file_set_keyring_pass(self, private, key, keyring)
7. assert_that(is_string(key))
gaborcsardi commented 2 years ago

This is probably the same as #116 and will have to be fixed in askpass: https://github.com/r-lib/askpass/issues/3

Until then you can obtain the password in a different way and use kb$set_with_value().

itsjimbo commented 2 years ago

Is it possible to switch the "passwording prompt function" from askPass to getPass? I have not looked at the internals, but is that something I can write a pull request for?

gaborcsardi commented 2 years ago

I prefer not to do that. However if you want to use getPass, you can do it like this: https://github.com/r-lib/keyring/issues/116#issuecomment-981119647