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

ripe-hamburger-42198

04/10/2022, 12:33 PM
phrased another way, is my backend supposed to query /sessions/whoami?
j

jolly-tiger-57705

04/11/2022, 7:38 AM
I think the only ways is to query whoami. The cookie is httponly, so you won't be able to access it.
m

magnificent-energy-493

04/11/2022, 9:52 AM
Janek is correct here. You need to call whoami.
j

jolly-tiger-57705

04/11/2022, 9:55 AM
I think login and registration API returns id info, you can save it in localstorage and check it before doing whoami. This could speed up discovering if the user is logged in.
m

magnificent-energy-493

04/11/2022, 10:01 AM
Yea you can use some caching or local storage strategies to reduce the amount of calls you make to Kratos! / We do not have documentation for this however (yet!)
j

jolly-tiger-57705

04/11/2022, 10:31 AM
@User How is the this JSON returned together with the 303 redirection? https://www.ory.sh/docs/kratos/self-service/flows/user-registration#with-auto-login-on-registration-1
Found it - it's in the body, but Accept: application/json has to be set
m

magnificent-energy-493

04/11/2022, 12:16 PM
Right, this is described here: https://www.ory.sh/docs/kratos/concepts/browser-redirect-flow-completion#json Do you think we should add a link from the self-service docs to this to make it easier to find?
2 Views