many-garden-6507
04/23/2022, 7:23 AMory
.toSession()
.then(({ data }) => {
// User has a session!
setSession(data)
})
._catch_(() => {
// Redirect to login page
_return_ router.push(edgeConfig.basePath + '/ui/login')
})
it takes some time to ensue if user is already loged in or not and during this time ui remains blank and than transitions to login page which is not smooth experience specially if i want to implement this in different pages, so my question is, is there other way to getting session which does not take much time?fetch(
'<https://playground.projects.oryapis.com/api/kratos/public/sessions/whoami>',
)
.then((res) => res.json())
.then((session) => console.log(session))
it gives cors origin error, i am running app locallyproud-plumber-24205
04/23/2022, 12:22 PM<http://localhost:4000|http://localhost:4000>
however the origin you are requesting is on https://<slug>.projects...com
To get around this you need to use the Ory cli proxy and have the proxy handle the traffic to the playground project as well as your application