best-hair-72217
03/19/2024, 6:50 PMapp.get("/", requiresAuth(), (req, res) => {
// From the quickstart identitiy section
// Always fails
ory
.toSession({ cookie: req.header("cookie") })
.then(({ data: session }) => {
console.log("************ All good with Ory ****************");
})
.catch((err) => {
console.log("************* Not so good with Ory ***********");
console.dir(err.data);
//res.redirect("/.ory/ui/login")
})
// From the quickstart OAuth2/OIDC section
// Shows tokens
req.oidc.fetchUserInfo().then((userInfo) => {
res.send(
`<html lang='en'><body><pre><code>${JSON.stringify(
{
accessToken: req.oidc.accessToken,
refreshToken: req.oidc.refreshToken,
idToken: req.oidc.idToken,
idTokenClaims: req.oidc.idTokenClaims,
userInfo,
},
null,
2,
)}</code></pre></body></html>`,
)
})
})