Auth service in microservice architecture
I'm trying to build a Hono backend setup with two separate services:
One serves as the auth server that handles all user-related logic (base path: /auth), and the other handles business logic (base path: /api).
In production, both will be hosted on the same domain. Locally, I'm using localhost:3000 for the business logic and localhost:3001 for auth.
Currently, I’m able to log in with Google OAuth via the auth server from the frontend but when I try to fetch data from the API backend, the session is null, which results in a 401 error.
I’ve looked through previous threads, and it seems like using the jwt plugin is a solution?
How should I configure the better-auth instance to work across both applications?
One serves as the auth server that handles all user-related logic (base path: /auth), and the other handles business logic (base path: /api).
In production, both will be hosted on the same domain. Locally, I'm using localhost:3000 for the business logic and localhost:3001 for auth.
Currently, I’m able to log in with Google OAuth via the auth server from the frontend but when I try to fetch data from the API backend, the session is null, which results in a 401 error.
I’ve looked through previous threads, and it seems like using the jwt plugin is a solution?
How should I configure the better-auth instance to work across both applications?