feat: update getClientAccessToken to use query parameters and validate inputs

master
adriano 2025-06-30 18:30:37 -03:00
parent 26704767ba
commit 5f6c8be1c9
1 changed files with 5 additions and 2 deletions

View File

@ -595,10 +595,13 @@ const webhook_crm = async (req, res) => {
const getClientAccessToken = async (req, res) => {
const { companyId } = req.params
const { clientId } = req.body;
const { clientId } = req.query
console.log('========> getClientAccessToken companyId: ', companyId, ' clientId: ', clientId);
mustContainProperties(req, ['clientId']);
if (!companyId || !clientId) {
console.error('Company ID or Client ID is missing in the request parameters.');
return res.status(StatusCodes.BAD_REQUEST).send({ msg: "Company ID and Client ID are required!" });
}
const accessToken = await getAccessToken(clientId, companyId);