I’m trying to use Apollo to connect two apps (1 Meteor Web app and 1 React Native mobile app).
I want both of these apps to rely on the same Mongo database.
However the Meteor accounts system is a big problem. How can I authenticate from the server, return the token and check for security without re-authenticating before every GraphQL query?
Is there an example of this? Also what is the plan for the Meteor Accounts package when AtmosphereJS becomes obsolete and Apollo supports all non-Meteor tech stacks?
I think we want to build accounts into Apollo eventually. Why do you need to re-authenticate for each GraphQL query? Couldn’t you get a login token once and store it on the device, then send it with each query?
That’s what I want to do.
But as far as I know, there’s no “server” login method for Meteor accounts package. So how am I suppose to authenticate into Meteor from server using Apollo?
1 Like
Try this: https://github.com/stubailo/meteor-rest/tree/devel/packages/rest-accounts-password
Basically you can make one HTTP request from your app to get the token, then set it on the header like this: http://docs.apollostack.com/apollo-client/meteor.html#Using-with-Meteor-Accounts (of course, replace Accounts._storedLoginToken()
with the one you got from the server)
1 Like
thank you.
Can you also confirm for me the future of Meteor platform?
It looks like with Apollo, pubs & subs no longer make sense. Leading with Meteor 1.4, do you plan to strip all back-end features of Meteor and turn Metoer into a front-end framework?
Meteor does a lot more than just data and UI - in fact I’d say the primary value is the build system. So I’m not really sure what you mean by “front-end”.
Right now using pub/sub with Apollo makes a lot of sense if you need reactivity. In the future, we hope that Apollo will have all of the features that Meteor’s data stack has today and more, and it will be easy to migrate whenever you want to. That definitely won’t be Meteor 1.4. Maybe much later.
But if course if Apollo without Meteor meets your needs then that’s a great way to go as well! All up to you to decide where you get the most value.