set resource session cookie in proxy via param

This commit is contained in:
Milo Schwartz 2024-11-23 23:31:22 -05:00
parent 34c9093469
commit d7c4bc43a4
No known key found for this signature in database
12 changed files with 143 additions and 81 deletions

View file

@ -27,6 +27,7 @@ export const authWithPincodeParamsSchema = z.object({
export type AuthWithPincodeResponse = {
codeRequested?: boolean;
session?: string;
};
export async function authWithPincode(
@ -126,18 +127,20 @@ export async function authWithPincode(
token,
pincodeId: definedPincode.pincodeId,
});
const secureCookie = resource.ssl;
const cookie = serializeResourceSessionCookie(
token,
resource.fullDomain,
secureCookie,
);
res.appendHeader("Set-Cookie", cookie);
// const secureCookie = resource.ssl;
// const cookie = serializeResourceSessionCookie(
// token,
// resource.fullDomain,
// secureCookie,
// );
// res.appendHeader("Set-Cookie", cookie);
logger.debug(cookie); // remove after testing
// logger.debug(cookie); // remove after testing
return response<null>(res, {
data: null,
return response<AuthWithPincodeResponse>(res, {
data: {
session: token,
},
success: true,
error: false,
message: "Authenticated with resource successfully",