<@U04UQ68083H> after successful login with google ...
# ory-copilot
r
@chilly-king-10285 after successful login with google I get a “ory_kratos_continuity” cookie set. I’m not sure what I need to do next to get the actual ory session cookie that I need for authentication in my web application.
c
A message from kapa.ai
After a successful login, Ory Kratos responds with a HTTP 303 Redirect to the configured redirect URL. Alongside this redirect, a
Set-Cookie
header is set which contains the Ory Session Cookie. This cookie is named
ory_kratos_session
. You can use this session cookie to authenticate subsequent requests in your web application. For example, when making a request to the
/sessions/whoami
endpoint, the session will be returned if the browser sends the request with the session cookie. Here is an example of how you can check the current session in a React application:
Copy code
javascript import { Configuration, FrontendApi, Session } from "@ory/client"   import { useEffect, useState } from "react"      const frontend = new FrontendApi(    new Configuration({    basePath: "<http://localhost:4000>", // Use your local Ory Tunnel URL    baseOptions: {    withCredentials: true,    },    }),   )      export function checkSession() {    const [session, setSession] = useState<Session>(undefined)       useEffect(() => {    frontend    // the cookie is automatically sent with the request    .toSession()    .then(({ data: session }) => {    setSession(session)    })    .catch((error) => {    // The session could not be fetched    // This might occur if the current session has expired    })    }, [])       return session ? (    <table>    <tr>    <th>Session ID</th>    <th>Expires at</th>    <th>Authenticated at</th>    </tr>    <tr id={session.id}>    <td>{session.id}</td>    <td>{session.expires_at || ""}</td>    <td>{session.authenticated_at || ""}</td>    </tr>    </table>    ) : (    <div>Loading session data...</div>    )   }
For more information, you can refer to the [Ory Kratos documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-login#successful-login) and [Ory Session Cookie usage](https://www.ory.sh/docs/kratos/session-management/overview#using-ory-session-cookie).