loud-honey-70375
11/17/2022, 7:50 PMtoSession
method on the backend server (Node.js/Nest.js), and passing in the cookie sent from the client. This works fine on my self-hosted ory kratos instance, where the cookie name is ory_kratos_session
, but after signing in via the Ory Network in production, the cookie name is ory_session_[MY_API_ENDPOINT]
which doesn't seem to be picked up by the ory client as it returns a 401loud-honey-70375
11/17/2022, 8:05 PMconst session: Session | null = await this.ory
.toSession(undefined, request.headers['cookie'])
.then((result: AxiosResponse<Session>) => {
request.userId = result.data.identity.id;
return result.data;
})
.catch((e) => {
if (e.response.status === 401) {
throw new HttpException({
status: HttpStatus.UNAUTHORIZED,
error: 'error.sessionNotFound'
}, HttpStatus.UNAUTHORIZED);
}
console.error('Error Getting Session', e.response.status);
return null;
});
The server side session checkloud-honey-70375
11/17/2022, 8:46 PMloud-honey-70375
11/17/2022, 8:51 PMloud-honey-70375
11/17/2022, 9:03 PM