Expose Meteor user context to Express endpoints

Oooh, very interesting! I guess the benefit of using the same context is now you can use the same underlying function for a WebApp endpoint or a Meteor methods endpoint…

I just had a quick skim through the code and I can see you’re handling the expiring tokens which was the one thing I wanted to check :laughing:

As later additions?, I think it’d be nice to also have:

  • Login (with login token generation, expiries etc all consistent with DDP login)
  • Logout
  • Arbitrary tokens e.g. a long-lived API Token.

The first two I think were covered by this user’s custom middleware:

I think after all that, Meteor’s half way to internalising the same kind of functionality simple-rest etc had into the core (the next step would be figuring out how to safety expose HTTP endpoints for pub/sub, methods etc :sweat_smile:). Still perhaps best left to a 3rd party package (or alternatively, the separate efforts to improve Meteor method declarations), but at least the accounts plumbing is a lot simpler!

3 Likes