1

I've been using keyring reliably for months. All of a sudden, a bunch of scripts failed because my code to pull keys is returning nothing. I had a named keyring with a passcode. It appears to be gone.

When I run keyring::keyring_list I do have something though:

  keyring num_secrets locked
1                   9  FALSE

What is "1"? I think 9 is the number of secrets I had. But I can't figure out how to access this. I've tried keyring::key_list(keyring = NAME) where I used 1, "1" as names.

And what happened to my original keyring? How can I troubleshoot?

Edit: When the script runs via a batch file, I get this error:

Error in b_wincred_i_get(target) : 
  Windows credential store error in 'get': Element not found.

Calls: source ... b_wincred_parse_keyring_credential -> rawToChar -> b_wincred_i_get
Execution halted

I found one SO post (Error when using R to get credentials from Windows Cred Vault) that pointed me to make sure the credentials exist in Windows Credentials, I think they do ('credentials' is the name of the keyring):

enter image description here

Chris Umphlett
  • 380
  • 3
  • 15

2 Answers2

2

I had the exact same problem and this seems a bug of the keyring package. I filed an issue here and I will update this answer if I hear back from the developers.

For now:

Don't bother about the 1, that's just the row number of the data.frame that's being returned by keyring_list(). The keyring name is empty. Existing keys do seem to work anymore, though setting keys via the package does work.

As you can also probably tell, the number 9 is the number of credentials you have under 'Generic Credentials'. So it is kind of working, but the retrieval fails.

MS Berends
  • 4,489
  • 1
  • 40
  • 53
  • I ended up discussing it at GH as well, back then. Concluded that it wasn’t the pkg but that my windows credential manager had some kind of hiccup and deleted it. Now I maintain a backup of the credentials that I can restore from in case this ever happens again. – Chris Umphlett Dec 05 '21 at 14:19
  • 1
    Ah, but the solution is the `oskeyring` package, see https://github.com/r-lib/keyring/issues/121 :) I'll update the answer as soon as I've got it to work, so I can post reproducible code here. – MS Berends Dec 05 '21 at 19:54
  • 1
    I don't understand the reason he's suggesting that for accessing rings created by other software, you didn't say you did that? Nevertheless, I'm open to changing. Fairly soon, our primary method is going to switch to Azure Key Vault as we move some processes to the cloud, but I would still keep the keyring process locally for when I'm working interactively or developing/testing. – Chris Umphlett Dec 05 '21 at 21:59
0

I ended up having to re-create the ring, and create a process for backing up the keyring so that I can restore it if this happens again.

enter image description here

Chris Umphlett
  • 380
  • 3
  • 15