0

I am planning to develop isomorphic app using Mongodb stitch and Next.js. So,I was doing some testing. I made login page. And i logged in user with some user name and password. It shows that user is logged in and credential are saved in local storage.

I am using something as typeof window !== 'undefined' to require browser and server sdk.

When i reload page or request for new page. Server sdk shows that user is not logged In and when pages loads at browser it shows userId and as logged In user probably because browser sdk read access and refresh token local storage at client side.

So how mongodb server sdk manages user session. How it will know that user is already logged in. Browser sdk store user credential in browser local storage. But where does server sdk store user credential ?

FaisalAhmed
  • 3,469
  • 7
  • 46
  • 76

1 Answers1

0

Server login is stored in the file system. This location can be configured with Stitch.initializeAppClient by passing in a StitchAppClientConfiguration.

As far as I can tell, there is currently no explicit support for isomorphic apps in Stitch. A login session is specific to each client, in this case browser and server. I suppose you would have to loginWithCredential() on both clients.

Chris Bush
  • 126
  • 5
  • how can i loginWithcredential() on both clients? I mean user login at browser using browser sdk. which store credential in browser local storage. Now after once user is logged in how can login again at server ? – FaisalAhmed Apr 25 '19 at 07:08