Open JPL1 opened 6 years ago
I believe the problem lies here: https://github.com/badcodeltd/safecms/blob/master/src/safe/index.js#L43
Essentially, despite the browser being compiled for mock routing, the production application still believes it is running in a production environment because node isn't passing a NODE_ENV
value of dev
.
As such, loginForTest
is never run, and it tries to authenticate with the production environment (and, presumably, gets an invalid authentication code as a result).
I think the correct solution here is to allow the user to add a mock.flag
file in the project route which will tell the executable to use mock routing (essentially, if mock.flag is there, add a fake dev
NODE_ENV
to the running Node process.)
It's a good approach and solves the problem, but I've thought about it and would rather do it like this:
Rather than requiring a user to create a file, we could add it as a setting, the latest commits allow the creation of generic yes/no setting options, so adding this would be trivial. If the user sets "Use Mock routing" to true, re-start the app and re-authenticate with the mock routing network code.
I just don't like the idea of splitting the settings up between the GUI and the file system.
I don't think this will be much of an issue for many people as they won't be using mock routing to develop a website, but I was curious to see if it would work as I'm running out of credits on my Alpha2 account.
Trying this in Windows 10.
Open Safe Browser MR first and login, Open Safe-CMS - appears to authenticate in browser but hangs on opening screen "Waiting to Authenticate" Is there a config file that needs changing?
Safe CMS console: