Sign And Notarize ElectronJS App – Generate One Time Password

Sign And Notarize ElectronJS App – Generate One Time Password

This article will discuss how to notarize an ElectronJS I will add to this article it is mainly for me.

First login to you apple members account and create your app identifier.

You will be using this in your notarize.js file and package.json

You also need to generate a APP-SPECIFIC PASSWORD in your account and add this to a .env file in the root of your project.

Generate your APP-SPECIFIC PASSWORD here.

You .env file will look like this.

You can then update you package.json build section like this.

"build": {
    "appId": "com.example.test",
    "afterSign": "notarize.js",
    "dmg": {
        "sign": true
    "mac": {
        "hardenedRuntime": true,
        "gatekeeperAssess": false,
        "entitlements": "build/entitlements.mac.plist",
        "entitlementsInherit": "build/entitlements.mac.plist",
        "icon": "build/icon.png",
        "category": ""
    "files": [

Now you want to add this code to your notarize.js file.


const {
} = require('electron-notarize');

exports.default = async function notarizing(context) {

    const {
    } = context;

    if (electronPlatformName !== 'darwin') {


    const appName = context.packager.appInfo.productFilename;

    return await notarize({
        appBundleId: 'com.example.test',
        appPath: `${appOutDir}/${appName}.app`,
        appleId: process.env.APPLEID,
        appleIdPassword: process.env.APPLEIDPASS,
        ascProvider: '0000000000',


Hopefully now your app should sign successfully.

Leave a comment