anything-llm/server/endpoints/api/auth/index.js

34 lines
848 B
JavaScript
Raw Normal View History

const { validApiKey } = require("../../../utils/middleware/validApiKey");
function apiAuthEndpoints(app) {
if (!app) return;
app.get("/v1/auth", [validApiKey], (_, response) => {
/*
#swagger.tags = ['Authentication']
#swagger.description = 'Verify the attached Authentication header contains a valid API token.'
#swagger.responses[200] = {
description: 'Valid auth token was found.',
content: {
"application/json": {
schema: {
type: 'object',
example: {
authenticated: true,
}
}
}
}
}
#swagger.responses[403] = {
schema: {
"$ref": "#/definitions/InvalidAPIKey"
}
}
*/
response.status(200).json({ authenticated: true });
});
}
module.exports = { apiAuthEndpoints };