Hi Guys! I am getting stuck again...maybe someone ...
# general
f
Hi Guys! I am getting stuck again...maybe someone has some advice. I am trying to create a simple login/logout express POC and running into issues with the Logout flow. Does the createBrowserLogoutFlow API works as explained in https://www.ory.sh/docs/kratos/self-service/flows/user-logout#server-rendered-browser-applications ? Because I cant get the logout URL working, and as you can see in the video, I am with an open session in the browser (also double checked into the Ory console), but the endpoint argues that there is no session. Thanks in advance! My router:
Copy code
router.get('/', (req, res, next) => {
  ory
  .createBrowserLogoutFlow({ cookie: req.header("cookie") })
  .then(({ data }) => {
    data_logout_url = data.logout_url;
    data_logout_token = data.logout_token;
  })
  .catch((e) => {
    console.error(`${e.name}: ${e.message}`);
  })  
  next()
}, (req, res) => {
  ory
    .toSession({ cookie: req.header("cookie") })
    .then(({ data: session }) => {
      res.render("index", {
        title: "MyPOCProject",
        identity: session.identity,
        data_logout_url: data_logout_url,
        data_logout_token: data_logout_token,
      })
    })
    .catch((e) => {
      console.error(`${e.name}: ${e.message}`);
      res.redirect("/.ory/ui/login")
    })    
})
The template view:
Copy code
extends layout

block content
  h1= title
  p Welcome to #{title}
  p This is the very early <b>POC</b> for integrating <b>Ory.sh</b> into <b>MyPOCProject</b> ! ! !
  p You are logged in as: <font color=red><b><i>#{identity.traits.email}</i></b></font>
  p data_logout_url: #{data_logout_url}
  p data_logout_token: #{data_logout_token}

  <a href="#{data_logout_url}" class="button">Logout</a>