Electron Mac App - Request System Contact Access (node-mac-permissions)

127 Views Asked by At

I am building an electron mac app and require access to the users contacts. I want the app to display a popup, similar to the one attached below.

Popup Image

I discovered node-mac-permissions, and tried using it but when I run the askForContactAccess() function, nothing happens. According to the npm page, it says that you have to update certain values on the Info.plist file for this to work, however there is no Info.plist file to add to.

I tried creating an Info.plist file to add these values to, but this did not fix the issue. I also tried building the app using electron builder, then modifying the generated Info.plist file to include these values and this also did not resolve the issue.

Here is the code I am using

const { askForContactsAccess} = require("node-mac-permissions");
askForContactsAccess().then((status) => {
    console.log(`Access to Contacts is ${status}`);
});
0

There are 0 best solutions below