Skip to content
Permalink
Browse files
fix: herroku session storage
  • Loading branch information
MantasMikal committed Jan 17, 2021
1 parent e4e2b52 commit c3cb58b244d3c61ac0577ec19ec68ed609642aaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
@@ -36,20 +36,13 @@ router.get("/registration-options", async (req, res) => {
authenticatorAttachment: "platform",
};

console.log('SESSION CHALLANGE: ', req.session)
console.log('SESSION CHALLANGE: ', req.session.challenge)


res.setHeader('Access-Control-Allow-Credentials', 'true')
res.json(registrationOptions);
});

router.post("/register", async (req, res) => {
const { credential } = req.body;

console.log('SESSION CHALLANGE: ', req.session)
console.log('SESSION CHALLANGE: ', req.session.challenge)

const challenge = new Uint8Array(req.session.challenge.data).buffer;
credential.rawId = new Uint8Array(
Buffer.from(credential.rawId, "base64")
@@ -26,6 +26,8 @@ app.use(
);

app.use(function(req, res, next) {
console.log('SESSION: ', req.session)
req.session.viewCount = req.session.viewCount ? req.session.viewCount + 1 : 0
res.header('Access-Control-Allow-Credentials', true);
res.header('Access-Control-Allow-Origin', req.headers.origin);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
@@ -40,9 +42,8 @@ app.use(
resave: false,
saveUninitialized: true,
cookie: {
secure: true,
maxAge: 60000,
httpOnly: true
secure: false,
maxAge: 600000
},
})
);

0 comments on commit c3cb58b

Please sign in to comment.