Hi everyone! We are implementing Kratos on a React...
# talk-kratos
Hi everyone! We are implementing Kratos on a React App, using the guides in your documentation. However, we are facing some difficulties. One is the way of how to tell if the user is logged in or not. HttpOnly cookies afaik, are not readable by JS, and I wanted to know what is the recommended way of getting this to work. The other question is related to the Client SDK for JS. I wanted to know if it has a stable version and if we can use it in production.
In order to determine whether a user is logged in, query the whoami endpoint: https://www.ory.sh/kratos/docs/guides/login-session/#browser-client
Regarding your second question, I don't know the answer. Personally I prefer generating the client myself (it can be generated using openapi-generator-cli)
@User thank you for the answer. Regarding the first, I know about the endpoint, but do you suggest sending a request to whoami every time the user reloads the page?
You address that some caching possibly, I just recently saw a discussion about this, let me see..
There is no right answer to that. If you prefer, you can store the result in local storage or something similar.
👍 1