@accounts/rest-express
Version:
Server side REST express middleware for accounts
21 lines • 896 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.serviceVerifyAuthentication = void 0;
const send_error_1 = require("../utils/send-error");
const express_validator_1 = require("express-validator");
const matchOrTrow_1 = require("../utils/matchOrTrow");
const serviceVerifyAuthentication = (accountsServer) => [
(0, express_validator_1.param)('service').isString().notEmpty(),
async (req, res) => {
try {
const { service } = (0, matchOrTrow_1.matchOrThrow)(req);
const isAuthenticated = await accountsServer.authenticateWithService(service, req.body, req.infos);
res.json(isAuthenticated);
}
catch (err) {
(0, send_error_1.sendError)(res, err);
}
},
];
exports.serviceVerifyAuthentication = serviceVerifyAuthentication;
//# sourceMappingURL=verify-authentication.js.map
;