Allow providing auth session token via HTTP header

This commit is contained in:
Florian Weber
2022-04-27 13:02:57 +02:00
committed by GitHub
parent aacc3a8f10
commit 65282fef26

View File

@@ -23,7 +23,12 @@ module.exports = (req, res, next) => {
} }
// authentication via session/cookie // authentication via session/cookie
const token = req.cookies["sdsession"]; let token = req.cookies["sdsession"];
if (!token || token == null) {
// authentication via session/header
token = req.headers["x-spacedeck-auth"];
}
if (token && token != "null" && token != null) { if (token && token != "null" && token != null) {
db.Session.findOne({ where: { token: token } }) db.Session.findOne({ where: { token: token } })