mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
20 lines
567 B
TypeScript
20 lines
567 B
TypeScript
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
|
|
import { validateApiToken } from '@documenso/lib/server-only/webhooks/zapier/validateApiToken';
|
|
|
|
export const testCredentialsHandler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|
try {
|
|
const { authorization } = req.headers;
|
|
|
|
const result = await validateApiToken({ authorization });
|
|
|
|
return res.status(200).json({
|
|
name: result.team?.name ?? result.user.name,
|
|
});
|
|
} catch (err) {
|
|
return res.status(500).json({
|
|
message: 'Internal Server Error',
|
|
});
|
|
}
|
|
};
|