Command Line / Script Auth on OSX


In pursuit of some simplified APIs and RDF usage I’ve been dabbling with some simple command line proof of concept lark in node.

With this, I obviously came a cropper upon the auth mechanism, which has proved problematic on MacOS to say the least.

Building upon the work of @bzee and @happybeing with scripted auth responses, I’ve managed to get a small workaround going for :apple: .

You can see the full (super POC, unstable, still pretty horrid code) lib here,(which is still not working against prod) but the specific of the workaround are thus:


Using url registration for apps means we have to abide by how MacOS opens these apps. And it does that not in a command line/script fashion (which is how windows/linux operate), but by executing the target and passing a native MacOS event to it with the URL as a param, (an event which you can’t pick up in a script… at least not in any simple fashion I found).


Applescript can be used to make a ‘fake’ application, which we register as the url handler of the application, and do so passing in a bundle id which is also prescribed to the ‘fake app’.

The application simply punts on the URL received to the target script. (You need an applescript viewer to read this, but it just does a shell execute of a neighboring index.js file.

This Info.plist, also then must have the app’s registered URL scheme assigned to it for OSX to behave, so we do that automatically.

The last step is moving/renaming our fake app, to the location registered upon build. And so far, this works!

CLI auth via browser on MacOS!

edit: I forgot above, but this is using a modified safe_app branch

SAFE Drive - OSX
Java API support on desktop platforms