anything-llm/server/endpoints/api/auth/index.js
Timothy Carambat defe6054b3
Full developer api (#221)
* Autodocument Swagger API with JSDocs on /v1/ endpoints for API access
implement single-player API keys
WIP Admin API Keys

* Create new api keys as both single and multi-user

* Add boot and telem

* Complete Admin API

* Complete endpoints
dark mode swagger

* update docs

* undo debug

* update docs and readme
2023-08-23 19:15:07 -07:00

34 lines
848 B
JavaScript

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 };