So I have two services that run, each with their own database. S1 stores user information and other primary data. Users also login and signup via S1 endpoints. S2 stores the same user information and other data too, but this is a separate service that users can access but do not need to signup with.

I'm finding that to synchronize user data, I have to make explict calls from S2 to S1 to retrieve the most upto date user information. My way around this up until this point is to have the same JWT secret used in both applications.

This way, when a user authentications with S1 and gets a JWT in return - it calls S2 with that same JWT. If i need to sync data in S2, I will simply make calls from S2 to S1 using the JWT that was given by the user.

It feels wrong but it works, what should I really be doing here instead without overengineering?

  • If user and authentication data is needed by more than one service, it should be split off into a service of its own. If that's not feasible, the solution that you're using isn't too bad either even though it's not really clean as your intuition indicates. – Hans-Martin Mosner Feb 23 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.