I am working with an Electron App. It required an authentication mechanism working as below:
- There is a main window which displays almost info including the data and login status.
- When the user is not authorized, a Login button will show up instead.
- The login function will load the user to a proxy server url in which the users can input their username and password.
- If the user input is correct, an successfull message may have returned and then the user will be authorized.
The issue was that I clicked the Login button on the development env, the proxy server window had been poped up so I could input my username and password, however, it seemed to work differently after I had built the application to the exe file as the Login mechanism automatically had invoked and it showed the success message although I had not input my username and password again.
This is the deps I am using
"dependencies": {
"@electron/remote": "2.1.2",
"@emotion/react": "11.13.3",
"@emotion/styled": "11.13.0",
"@mui/icons-material": "6.1.1",
"@mui/lab": "6.0.0-beta.10",
"@mui/material": "6.1.1",
"@mui/x-tree-view": "^7.18.0",
"@reduxjs/toolkit": "^2.2.7",
"clsx": "2.1.1",
"cors": "2.8.5",
"cross-env": "7.0.3",
"date-fns": "4.1.0",
"dotenv-cli": "^7.4.2",
"electron-log": "5.2.0",
"electron-store": "8.2.0",
"express": "4.21.0",
"js-yaml": "4.1.0",
"node-disk-info": "1.3.0",
"node-stream-zip": "^1.15.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-redux": "9.1.2",
"redux": "5.0.1",
"redux-devtools-extension": "2.13.9",
"redux-thunk": "3.1.0",
"semver": "7.6.3",
"unzipper": "^0.12.3",
"xml2js": "0.6.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"build-electron": "tsc -p tsconfig.electron.json",
"watch-electron": "tsc -p tsconfig.electron.json -w",
"start-electron": "electron dist/index.js",
"dev-electron": "cross-env NODE_ENV=development electron dist/index.js",
"postinstall": "electron-builder install-app-deps",
"release": "dotenv -- electron-builder --win -c.extraMetadata.main=dist/index.js",
"licenses": "license-checker-rseidelsohn --csv --production --direct --out licenses.csv",
"testBuild": "npm run build && npm run start-electron"
},
"devDependencies": {
"@testing-library/jest-dom": "6.5.0",
"@testing-library/react": "16.0.1",
"@testing-library/user-event": "14.5.2",
"@types/express": "4.17.21",
"@types/jest": "29.5.13",
"@types/js-yaml": "^4.0.9",
"@types/node": "22.5.5",
"@types/react": "18.3.8",
"@types/react-dom": "18.3.0",
"@types/react-redux": "7.1.33",
"@types/semver": "7.5.8",
"@types/unzipper": "^0.10.10",
"@types/xml2js": "0.4.14",
"ajv": "^8.17.1",
"devtron": "1.4.0",
"electron": "32.1.2",
"electron-builder": "25.0.5",
"license-checker-rseidelsohn": "4.4.2",
"npm-check-updates": "^17.1.2",
"postcss-normalize": "^13.0.0",
"prettier": "3.3.3",
"react-scripts": "5.0.1",
"typescript": "5.6.2"
},
Please give me some advices if anyone faced this previously.
I want the built exe version works exactly like the one on my development environment.
Eric Trinh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.