A similar issue to what I encountered on macOS is plaguing me on Ubuntu…
My issue is that when the SAFE Browser sends the ‘auth-response’ back to my application, it opens another instance of the application… Meaning the original version that tried to initializeApp never hears a response.
My code to do with the URI scheme is almost identical to what’s in this app…
I have tested it on Ubuntu and sure enough safe-app-base works perfectly. My app however…
… Doesn’t work. The only real difference I can see is that I am using electron-forge to orchestrate the running of the application. I fail to see though how this would break things. It is worth noting that my app exhibits this behaviour when ran through the command line. When packaged, it does hear the response back but I get a “Could not connect to the SAFE Network” error message. I am guessing these issues are interrelated. Things work perfectly on macOS so I am guessing this is an Ubuntu only issue. If anyone has any advice on how to fix this that would be amazing.
FYI - I’ve had some trouble running the email example before where the only way I could get it to work was to formally build the executable, then run the executable explicitly from the command line.
@DaBrown95, as @jlpell explains it, it has to do with how to launch the app in each case (unpackaged/packaged), and we’ve also been working on this to have our example apps to register the URI correctly in both cases. @hunterlester was able to fix it in the email app, but he is still working on getting it right for the WHM, perhaps he can share more details of it. You can also take a look at the master branch of the email app and see if that approach also works for your app.
Thanks for pointing me in that direction, I will take a look shortly… Hopefully the fix I am looking for is in there. The Email example app uses electron-forge too so that should be the most similar to mine.
@hunterlester is there anything specifically you can remember that had to be included to correct this functionality?
Amazing, Thank you so much @hunterlester! It now functions as expected which is awesome. That fix even fixes the issue with running the app packaged which is awesome.
One strange thing though… When running the app through yarn start, On hearing the ‘auth-response’ I am presented with this error message…
app.exit() instead of app.quit(). I tried this and sure enough, it fixed the issue. Very strange. Just thought I would add this fix here for future reference. Looking at the Electron Documentation…
It looks like unless you properly handle the before-quit and will-quit event then using app.quit() then that might be what is causing the error message that I get.