https://www.ory.sh/ logo
#talk-kratos
Title
# talk-kratos
l

lively-beard-47107

01/12/2022, 2:17 PM
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.
a

able-glass-7253

01/12/2022, 3:03 PM
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)
l

lively-beard-47107

01/12/2022, 3:08 PM
@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?
m

magnificent-energy-493

01/12/2022, 3:10 PM
You address that some caching possibly, I just recently saw a discussion about this, let me see..
a

able-glass-7253

01/12/2022, 3:11 PM
There is no right answer to that. If you prefer, you can store the result in local storage or something similar.
👍 1
2 Views