Safe browser auth request pop-up error

I’m learning how to use the integrated authenticator, having compiled the dev branch of safe browser and following the example of MaidSafe’s web hosting manager.

Running safe browser binary for Windows.

Problem number one

The first two times I ran web hosting manager I was able to see the auth pop-up within the authentication manager, but no longer.

Problem number two

The app that I’m building (simply meant to upload my website to mock routing), following the example, also uses shell.openExternal(..., which will get my open authentication management page to come to the fore but I’ve haven’t been able to get the the pop-up to appear.

let shell = require('electron').shell;
let safeApp = require('safe-app');

const appInfo = {
	'id': '',
	'name': 'Host Website',
	'vendor': 'hunterlester'

const containers = {
  _public: [
  _publicNames: [

const parseUrl = (url) => (
  (url.indexOf('safe-auth://') === -1) ? url.replace('safe-auth:', 'safe-auth://') : url

safeApp.initializeApp(appInfo).then(app => app.auth.genAuthUri(containers, {own_container: true}).then(uri => {

These two problems appear to be separate issues, but I’m not sure.

My research:

I’m wondering how the auth pop-up receives an event signal to show itself.

In safe_browser\app\shell-window\ui\navbar.js:

ipcRenderer.on('onAuthReq', function(event, data) {
  if (data) {
    safeAuthData = data

The onAuthReq event is called from safe_browser\authenticator\src\protocols\safe_auth_rpc.js:

const registerOnAuthReq = (event) => {
  clientManager.setAuthReqListener((req) => {
    event.sender.send('onAuthReq', req);

In the same file, the event listener ipcMain.on('registerOnAuthReq', registerOnAuthReq); is set.

Back in safe_browser\app\shell-window\ui\navbar.js, an event is sent on the registerOnAuthReq channel:

This is where the trail goes cold for me. I can’t find from where else the onAuthReq event is signaled.
I also can’t figure out why the pop-up no longer shows up for web hosting manager.


Thank you to the developers that created the web hosting manager example, safe browser, the plugin integrations, and the core files. I won’t name you all here because I don’t want to leave any contributors out.

Something to be celebrated at this point is that you all have created a code base that is so clear and easy to read that I, as a novice programmer, can follow along to get a sense of how it works and to also receive education from it.

@dirvine, you’ve achieved what you wanted as far as making the code base accessible and easy to understand.

Learning so much. Thank you.


That was a personal goal of mine and for the team in general. Glad to read its working out that way :slight_smile: .

I recommend using app.auth.openUri instead, it has some better url handling and fixes for more platforms. But that shouldn’t cause the troubles you are having …


If the app is authorised we don’t prompt the authorisation confirmation again. Do you get back the response back from the authenticator, @hunterlester?


@ben @Krishna

Here’s my repository:

This is my build for safe_browser:
(Not sure if this is helpful)

safeApp.initializeApp(appInfo) is returning a promise that resolves to an object that contains the app info, connection, and api handles.

The connection is null and if I try to create a random public mutabledata, I receive an error:

(in promise) Error: Setup Incomplete. Connection not available yet.
    at SAFEApp.get connection [as connection]

You need to wait for the IPC response asynchronously before being able to use the API in L#36
The IPC response provides you with the auth URI that you need to setup the connection with safeApp.fromAuthURI.
Unfortunately I don’t have a snippet with all that yet, but you can see this here:

and here:


I’m seeing that auth-response is sent here:
when the open-url event is triggered. However, I’m reading in the electron app event doc that open-url is only for macOS and I’m working on Windows.

At the point of opening the safe-auth uri, safe-auth://..., with shell.openExternal, is this supposed to trigger the open-url event within the electron app lifecycle?

Researching now about alternatives to open-url on Windows.

What data am I expecting from the open-url callback? The safe-uri? Or that it was successfully opened?

shell.openExternal returns a boolean of whether or not the uri was successfully resolved, so I’m not sure why I need the open-url event.

Does the lack of open-url event account for the auth pop-up never appearing?

Is safeApp.fromAuthURI for connecting apps whose auth uri’s have previously been authenticated?

Just thinking out loud here for my next clue, I don’t expect you to answer all of this.


That seems to be used only when running the app with npm run start-hot mimicking the auth response (I’m not really familiar with the hot mode):

I’m not sure but it sounds to me that this is probably why @ben made that suggestion before, please give it a try.

You should expect a boolean which tells whether an application was available to open the URL.
After that, the authenticator should be requesting the user to authorise the app (or if it’s already authorised just retrieve the app’s auth uri), and return it to the app, that’s why you need to wait for the ipc event I mentioned before. The ipc would contain the auth uri you need to connect to the network.

Correct, so you first need to obtain it which is what you do with genAuthUri and openUri, after that you are able to connect to the network with fromAuthURI.


Making progress this morning.
:seedling::herb: :four_leaf_clover: :evergreen_tree:

The authenticator pop-up is appearing now for both the Safe Web Hosting example and my own app, when I up the version numbers or just change the app info.

Apps are also receiving an auth response only when packaged as an application that can be accessed through my system’s registry, so the response won’t make it to an app running in development from the command line.

Thank you everyone.
More to come :smiley:


Self web hosting example is safe-browser api?

The web hosting example uses safe_app_nodejs to access low level api library.

1 Like


I’ve just been diving down this same rabbit hole. Was this ever solved? Or is it while developing we should just use the app.auth.loginForTest(APP_INFO.permissions) to generate credentials etc?

1 Like

Is this anything to do with the [web_hosting_manager getting stuck] ( or am I way off here?! :slight_smile:



No, this is different than what people are currently troubleshooting with the latest releases.

Thank you for bringing that thread to my attention. I have to get on with chores, but until I make time to dig into reading more, do you have an idea of what’s generally giving people trouble? Primarily keytar and/ or MockVault conflicts?

I went through hell week figuring out so many problems that I created for myself on Windows, so send any Windows users my way for help.


I haven’t thought to try app.auth.loginForTest(APP_INFO.permissions) yet. Does it change the way the app is registered with the system?

I’ll play with that some time this week.

Right now, my apps running in development are registered with the electron executable in my app’s node_modules:


Haven’t had a chance to test yet. I suspect not if what you suggest is solving the problem.

For clarity @hunterlester, this is your windows registry where you’re adding in the electron of the development project? Which allows your dev project to be found by the compiled SAFE Browser?

I’m not on windows, but I’ll have a look into how the Mac handles this and report back this eve if I find a thing.

(I’ll also try the loginForTest just incase, but I doubt that’s it then).

1 Like

No sorry no insights, I haven’t been playing just watching and seeing several people with this issue but I’m not sure if any Windows users have this problem or not. For Linux there is now a github issue: I’ll look out for any Windows folk reporting.

1 Like

That’s exactly right

Is anything supposed to happen from loading your app besides seeing this:

Hello World!

We are using Node.js 6.5.0, Chromium 53.0.2785.143, and Electron 1.4.15.

And it being available in Authorised applications?

Nothing else happening there. Just enough running to test safe_app_nodejs and safe_browser compiled from dev branch

What about being able to see the page in the SAFE Network? eg. safe://yourapp

I’m new here and I have yet to see an app working even locally.

To achieve that:

  • start SAFE browser
  • start / authorise the web_hosting_manager
  • use it to create a public ID: myapp
  • use it to register a Web service for myapp (here you also map to a public directory you created)
  • use it to upload files including index.html to that directory
  • visit safe://myapp using SAFE browser

You can do all the above programmatically using the API of course. @WhiteOutMashups did this using the old API so somebody could port that as an alternative to the web_hosting_manager.

Sorry I can’t be of more help due to lack of time.