dry-analyst-51676
04/29/2022, 9:46 PMconst kratos = new V0alpha2Api(
new Configuration({
basePath: '.ory',
}),
);
return kratos
.toSession(undefined, request.header('Cookie'))
.then(({ data: session }) => {
console.log(session);
return true;
})
.catch((err) => {
console.error(err);
return false;
});
(Even though the ExpressJS documentation uses baseUrl
not basePath
-- I think it's wrong?)
And then I can debug and see it always gets caught with an error in toSession()
. The error is always ECONNREFUSED to 127.0.0.1:80, seemingly hitting the URL .ory/sessions/whoami
. One of the properties of the err.request
objects is _currentUrl
which is pointing to "http:.ory/sessions/whoami"
and I'm sure... that's... not right.
But it's not clear why this is wrong. Am I missing something in config? 🤔proud-plumber-24205
04/29/2022, 10:00 PMproud-plumber-24205
04/29/2022, 10:00 PMdry-analyst-51676
05/02/2022, 1:51 PMdry-analyst-51676
05/02/2022, 1:52 PMORY_SDK_URL
environment variable before I run it.proud-plumber-24205
05/02/2022, 1:59 PMlocalhost:3000
the proxy would be
ory proxy <http://localhost:3000>
with the ORY_SDK_URL
pointing to your project URL.
Maybe try set the base url /.ory
with the forward slash like with the expressJS example
https://www.ory.sh/docs/guides/protect-page-login/expressjs#require-login-to-access-the-home-pagedry-analyst-51676
05/02/2022, 2:00 PMdry-analyst-51676
05/02/2022, 2:00 PMlocalhost:3000
)dry-analyst-51676
05/02/2022, 2:06 PMory proxy --no-jwt --port 4000 <http://localhost:3000/>
But I used the one as you wrote it, and I re-added the forward slash. Same deal though.proud-plumber-24205
05/02/2022, 2:07 PMdry-analyst-51676
05/02/2022, 2:07 PMconst kratos = new V0alpha2Api(
new Configuration({
basePath: '<http://localhost:4000/.ory>',
}),
);
dry-analyst-51676
05/02/2022, 2:07 PMdry-analyst-51676
05/02/2022, 2:07 PMproud-plumber-24205
05/02/2022, 2:07 PMproud-plumber-24205
05/02/2022, 2:07 PMdry-analyst-51676
05/02/2022, 2:08 PMdry-analyst-51676
05/02/2022, 2:08 PMdry-analyst-51676
05/02/2022, 2:08 PMdry-analyst-51676
05/02/2022, 2:08 PMdry-analyst-51676
05/02/2022, 2:08 PMdry-analyst-51676
05/02/2022, 2:09 PMproud-plumber-24205
05/02/2022, 2:09 PM