<@U04UQ68083H> How should I refresh my kratos sess...
# ory-copilot
g
@chilly-king-10285 How should I refresh my kratos session?
c
A message from kapa.ai
To refresh a Kratos session, you need to append
?refresh=true
to the appropriate endpoint. The endpoint you use depends on whether you're working with a browser client or an API client. For browser clients, append
?refresh=true
to
/self-service/login/browser
. For example:
Copy code
<https://playground.projects.oryapis.com/self-service/login/browser?refresh=true>
For API clients, append
?refresh=true
to
/self-service/login/api
. For example:
Copy code
<https://playground.projects.oryapis.com/self-service/login/api?refresh=true>
Refreshing a session updates the
authenticated_at
time and won't log the user out, unless another user signs in. If you're implementing a UI, you can force the user to re-authenticate by calling the
/self-service/login/browser?refresh=true
endpoint. This is only applicable to the login flow and requires the user to already have a session. Here's an example of how to do this:
Copy code
javascript sdk.createBrowserLoginFlow({ refresh: true })
For more details, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-login#refreshing-a-session).