Skip to content

How to handle user session between server sdk and browser sdk in Isomorphic app Like Next.js #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
faisalahmedansari20 opened this issue Apr 24, 2019 · 2 comments

Comments

@faisalahmedansari20
Copy link

As we have discussed in #267 about how can we use stitch sdk in isomorphic app like Next.js . Now problem is that when user login first time it is obvious that browser sdk will store user credential at browser local storage.

But after login when, I refresh my page. On server inside getInitialProps() function it shows that user is not logged In. I think that is because App server does not know anything about user and its credential. And credential are at user side in browser local storage.

So my question is how can i handle such scenario?

or other scenario could be when user comes back and access my app. Server will assume user is not logged in and throw user on login page.

@adamchel
Copy link
Contributor

Hi @faisalahmedansari20,

Unfortunately, we do not yet have an SDK that explicitly supports isomorphic apps with frameworks like Next.js or Nuxt.js. This is something we plan on investigating in the near future, but I can't give any more specifics. We'll keep you updated with any new developments, and I'll leave this issue open until we have a solution.

@efleurine
Copy link

My best bet (I did not try it yet) would be to associate a API Key to everyone user and send that with cookies to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants