Search code examples
electronelectron-builder

releases.atom\n\nplease double check that your authentication token is correct. why?


enter image description here in main.ts

 autoUpdater.on('error', e => {
    dialog.showMessageBox(win, { message: (e as Error).message });
  });

in package.json

"build": {
    "appId": "com.github.orgname.reponame",
    "win": {
      "target": "nsis",
      "icon": "dist/apps/frontend/assets/app"
    },
    "nsis": {
      "oneClick": false
    },
    "asar": true,
    "directories": {
      "output": "releases/"
    },
    "files": [
      "**/*",
      "!**/*.ts",
      "!*.map",
      "!package.json",
      "!package-lock.json",
      {
        "from": "../dist",
        "filter": ["**/*"]
      }
    ],
    "portable": {
      "splashImage": "dist/apps/frontend/assets/app/preloader.png"
    }
  }

How to fix this error? How can I make it so that the user can receive updates when there is a release in github? Where to enter the token so that each client can auto-renew?


Solution

  • You will have to provide a personal access token to electron-updater for it to work. The quick and dirty fix I used:

      autoUpdater.setFeedURL({
         provider: 'github',
         repo: 'REPOSITORY_NAME',
         owner: 'OWNER_OF_REPOSITORY',
         private: true,
         token: '<PERSONAL_ACCESS_TOKEN_REFERENCE>'
       })
    

    I understand it might not be clear how to go about adding the PERSONAL_ACCESS_TOKEN_REFERENCE securely. Inputs to this answer are welcome.