realm-graphql
realm-graphql copied to clipboard
User.authenticate's server argument could be more flexible
In an attempt to work around https://github.com/realm/raas/issues/1075 I tried using WebPack dev servers ability to act as a proxy in-front-of your API (in this case I wanted it to be in front of ROS).
So I had the dev server proxy requests on http://localhost:8080/ros to my ROS instance on Realm Cloud. And I therefore wanted to pass http://localhost:8080/ros
when constructing the user:
const user = await User.authenticate(
credentials,
'http://localhost:8080/ros',
);
But because of https://github.com/realm/realm-graphql/blob/master/src/authenticationHelper.ts#L19 the /ros
part of the URL is removed and instead of appending /auth
to the url it becomes http://localhost:8080/auth
which fails with a 404.
I would expect the server URL passed to User.authenticate
to be the base URL of the ROS server, which could potentially have some path defined.