Meteor User Accounts as a micro service?

Let’s say you want to build multiple meteor apps, all of which use the same users database.

Therefore a username can only exist once.

Is it possible to host a meteor server whose entire role is to handle user accounts business (basically the accounts package), and then to have multiple meteor apps log in their users using this server?

Therefore none of the meteor apps have their own accounts system. Instead all user-accounts-related requests are handled by the remote accounts server.

Which Meteor APIs would you use to accomplish this? Would you use Accounts (multi-server)? Are there any example applications out there to inspect?

1 Like

When they log in, shall they automatically be logged in to every app or is it just the authentication info itself you want to centralize and they still need to log in on separately on each instance?

Every app is fine. Each app should be able to handle permissions given the user.

Then why not use a oauth server? No need to involve Meteor there.

On the apps:
https://atmospherejs.com/meteor/accounts-oauth (or some other package, I just picked at random)

and server (another random)

Because Meteor has one of the best accounts systems that I have seen. It’s actually very good.

And it’s very nice being able to use Meteor.User() and other Accounts API’s.

Is it easy enough to have access to the User on client and server if you use an OAuth server? Without rolling out your own in-app accounts-management system anyways?

1 Like

You would use that, the Oauth server is only for authentication so you’d have everything related to Accounts available at the individual apps.

As far as I’m aware, calling Meteor.User() and similar API’s is reliant on using the Accounts package.

If you use an OAuth server, you don’t get to take advantage of that functionality do you?

But you are using the Accounts package on the app servers. The Accounts package just “reaches out” for the actual authentication, vid OAuth, Google, Facebook or whatever.

Gotcha. Good solution. Thanks!

Possibly all the apps could access the same MongoDB database for purposes of accounts.

@larry, I’ve been kicking this idea around myself. But I would only want to use the Meteor Accounts package, not OAuth. I believe there’s still a surface for login without the individual applications having Accounts/Blaze installed specifically (I’ll have to look for an example).

So what was the conclusion to this?
Adding a complexity to the scenario:
““What if I want to subscribe 10 latest users in the app reactively””?