Add query string support

The javascript API is broken since the token is passed as a query string. This add support for it.