4

I have created a Mac application written in electron-vue. It requires keyboard access and screen recording access.

Ideally, when I give permission it should start working immediately.

But my app sometimes work after restarting. Sometimes, It keeps asking for permission after every restart even though we have given the permission.

I am not able to understand what is being done wrong.

Can you please help?

My package.json.

    "name": "pramod-dektop-creator",
    "version": "0.0.1",
    "description": "pramod-desktop-creator",
    "author": "Pramod <pramod@xyz.com>",
    "scripts": {
        "build": "node .electron-vue/build.js && electron-builder",
        "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
        "build:dir": "npm run build:clean && node .electron-vue/build.js && electron-builder --dir",
        "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
        "dev": "node .electron-vue/dev-runner.js",
        "pack": "npm run pack:main && npm run pack:renderer",
        "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
        "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
        "postinstall": "electron-builder install-app-deps",
        "rebuild": "electron-rebuild -f -w sqlite3"
    },
    "main": "./dist/electron/main.js",

    "build": {
        "afterSign": "notarize.js",
        "asar": true,
        "productName": "pramod-dektop-creator",
        "appId": "org.pramod.desktop-creator",
        "protocols": {
            "name": "pramod-dektop-creator",
            "schemes": [
                "pramod"
            ]
        },
        "directories": {
            "output": "build"
        },

        "dmg": {
            "sign": false,
            "contents": [
                {
                    "x": 410,
                    "y": 150,
                    "type": "link",
                    "path": "/Applications"
                },
                {
                    "x": 130,
                    "y": 150,
                    "type": "file"
                }
            ]
        },
        "mac": {
            "icon": "build/icons/icon.icns",
            "gatekeeperAssess": false,
            "entitlements": "info.plist",
            "entitlementsInherit": "info.plist",
            "hardenedRuntime": true
        },
        "win": {
            "icon": "build/icons/icon.ico"
        }
    },
    "iohook": {
        "targets": [
            "node-72",
            "electron-70"
        ],
        "platforms": [
            "win32",
            "darwin",
            "linux"
        ],
        "arches": [
            "x64",
            "ia32"
        ]
    },
    "license": "",
}
Pramod
  • 768
  • 1
  • 12
  • 27
  • 1
    I've faced this as well, not sure what's causing this, but I've found that the user has to un-check then re-check the app's accessibility permission checkbox in the system settings in order for keyboard control to work! This is possibly a mac issue? I'm facing this on Mojave. – aabuhijleh Mar 18 '20 at 15:04
  • Yes. I am facing the issue in Mojave too – Pramod Mar 18 '20 at 20:09
  • 1
    Did you run this application in development mode or run the production app after packing? – tpikachu Mar 19 '20 at 01:23
  • 1
    After packing the app and try to install your application to ```/Applications``` Then it will ask once – tpikachu Mar 19 '20 at 01:31
  • @tpikachu in my case, my app is packaged and installed in `Applications`, I think this issue happens every time I update Electron, though I'm not sure if that is indeed the cause. – aabuhijleh Mar 19 '20 at 07:16
  • I am facing this issue after I build and install dmg. App is installed in /Applications. @tpikachu – Pramod Mar 21 '20 at 17:27
  • Can you share the screen snap or gif? – tpikachu Mar 22 '20 at 15:00
  • facing a similar issue: 1st install and call `nav.getUserMedia` prompt asking permission for screen share. for 2nd install/update/overwrite expecting it to not ask permission as the user already permit / not permit it from the 1st install – noobHere Jul 28 '20 at 14:33
  • found out that everytime I increment version the `package.json`, it reset the permission and all.. – noobHere Jul 28 '20 at 14:49

1 Answers1

-2

Please check whether you have given permissions to correct application.

How?

Go to Security & Privacy settings. enter image description here

Right click on your application and select the option.

It will take you to the application for which permission is given.

Cross check whether it is the correct application you are giving access to.

For me, installed application was different than what I gave permission to.

I deleted duplicate application and gave permissions again. After that it started working.

May or may not solve your issue but worth a try.

Pramod
  • 768
  • 1
  • 12
  • 27