It turns out I wasn't quite right in my previous post when I said that there is no error given: it turns out that with judicious use of Firebug, you can examine incoming / outgoing http requests. The request for the login token with the Javascript API quite clearly states
Given URL is not allowed by the Application configuration.