Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

I have a problem. I always see confirmation popup on Mac OS (Electron 3) about access to Keychain even if I select Allow always. Is there any workaround for this? #135

Closed
victorious85 opened this issue Oct 23, 2018 · 12 comments · May be fixed by icemanreddy/node-keytar#3, Deckhandfirststar01/node-keytar#3 or icemanreddy/node-keytar#7

Comments

@victorious85
Copy link

victorious85 commented Oct 23, 2018

I have a problem. I always see confirmation popup on Mac OS (Electron 3) about access to Keychain even if I select Allow always. Is there any workaround for this?

@Strori
Copy link

Strori commented Oct 23, 2018

I have same problem.

@victorious85 victorious85 changed the title Problem I have a problem. I always see confirmation popup on Mac OS (Electron 3) about access to Keychain even if I select Allow always. Is there any workaround for this? Oct 23, 2018
@OlgaSergieieva
Copy link

I also have the same problem

@dmitrykurochka
Copy link

Waiting to get workaround too

@shiftkey
Copy link
Contributor

It's not clear to me which version of keytar anyone is running here (or the specific build of Electron). Can you add more details?

@dmitrykurochka
Copy link

The latest one

@victorious85
Copy link
Author

"keytar": "^4.3.0",

keytar
.getPassword(' key', userId)
.then(result => {
event.returnValue = result;
return Promise.resolve(true);
})
.catch(error => console.log('error: ', error));

This caused user prompt to allow using keychain every time. It would be very annoying for user. Have you faced the same issue?

@shiftkey
Copy link
Contributor

Have you faced the same issue?

I believe this issue is related to building and running an Electron app without codesigning (which often happens when developing locally), and the OS asks you to allow the app to access the keychain.

@victorious85
Copy link
Author

We have signed application and received the same result. Our application is not sandboxed. Could this cause this kind of issues?

@shiftkey
Copy link
Contributor

Again, I'm flying blind here and really need more information to understand the issue:

  • Which Electron build are you using? When you use keytar you are running it inside the Electron app, and if that's not trusted it's going to prompt. If this worked previously for you with Electron 2.x then maybe we need to loop in the Electron team to dig deeper about what might have changed between Electron 2 and Electron 3?
  • Is your codesigning still valid? You can confirm this by running codesign -dv --verbose=4 /path/to/your/electron-app.app
  • I believe choosing the "Always allow" option when prompted is tied to a specific version, so if you rebuild the app or change some version that gets forgotten and you need to trust it again

@victorious85
Copy link
Author

  1. "electron": "^3.0.2", "electron-builder": "^20.28.4"
    we started to use keytar only now and don't know if it worked with Electron 2.x
  2. All is valid
  3. It asks while application works without rebuilding.

@victorious85
Copy link
Author

I found a solution to my problem.
If you set a password from the main process and then attempt to get it from a renderer process, it’ll prompt a permissions dialog for the user.
Thanks you.

@aguynamedben
Copy link

If anybody finds this much later like I did... I had a similar issue upgrading to Electron 6 because I was doing keytar get/sets from the renderer process, and between Electron 5 and Electron 6 the Electron renderer process changes names, i.e. from "Electron Helper" to "Electron Helper (Renderer)". The name change trigger macOS to re-ask for permission for every single keytar.get.

More details here: #250

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.