⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(docs): add authentication guide and update API documentation
Andrej Acevski8a0cf446ccae
diff --git a/apps/docs/content/docs/api/authentication.mdx b/apps/docs/content/docs/api/authentication.mdxnew file mode 100644index 000000000..e4a426599--- /dev/null+++ b/apps/docs/content/docs/api/authentication.mdx@@ -0,0 +1,95 @@+---+title: Authentication+description: Learn how to authenticate API requests using API keys+---++import { Step, Steps } from 'fumadocs-ui/components/steps';+import { Callout } from 'fumadocs-ui/components/callout';++All API endpoints require authentication using an API key. This guide explains how to create an API key and use it to authenticate your requests.++## Creating an API Key++<Steps>+<Step>+**Sign in to Kaneo**++Sign in to your Kaneo instance using your account credentials.+</Step>++<Step>+**Navigate to Settings**++Go to your account settings by clicking on your profile or navigating to the Settings page.+</Step>++<Step>+**Open the Account Tab**++In the Settings page, click on the **Account** tab to view your account settings.+</Step>++<Step>+**Access API Keys Section**++Scroll down to the **API Keys** section in the Account tab. This section is located under the Developer Settings.+</Step>++<Step>+**Create a New API Key**++Click the **Create API Key** button to generate a new API key. You'll be prompted to provide a name for your API key to help you identify it later.+</Step>++<Step>+**Save Your API Key**++After creating the API key, you'll be shown the full API key value. **Copy and save this key immediately** - it will not be shown again for security reasons.++<Callout type="error">+**Important**: Store your API key securely. If you lose it, you'll need to create a new one. The API key cannot be retrieved after creation.+</Callout>+</Step>+</Steps>++## Using Your API Key++Once you have your API key, include it in the `Authorization` header of all API requests using the Bearer token format:++```bash+Authorization: Bearer your-api-key-here+```++### Example Request++Here's an example of making an authenticated API request using curl:++```bash+curl -X GET https://your-kaneo-instance.com/api/task?workspaceId=your-workspace-id \+ -H "Authorization: Bearer your-api-key-here" \+ -H "Content-Type: application/json"+```++### Example with JavaScript++```javascript+const response = await fetch('https://your-kaneo-instance.com/api/task?workspaceId=your-workspace-id', {+ method: 'GET',+ headers: {+ 'Authorization': 'Bearer your-api-key-here',+ 'Content-Type': 'application/json'+ }+});+```++## Security Best Practices++- **Keep your API keys secret**: Never commit API keys to version control or share them publicly+- **Use descriptive names**: Name your API keys clearly so you can identify their purpose (e.g., "Production Script", "Development Testing")+- **Rotate keys regularly**: Periodically create new API keys and revoke old ones+- **Limit key scope**: Only grant API keys to trusted applications and services+- **Monitor usage**: Regularly review your API keys and remove any that are no longer needed++<Callout type="warning">+If you suspect your API key has been compromised, immediately revoke it in the API Keys section and create a new one.+</Callout>diff --git a/apps/docs/content/docs/api/index.mdx b/apps/docs/content/docs/api/index.mdxindex 675857cfa..05736cc2e 100644--- a/apps/docs/content/docs/api/index.mdx+++ b/apps/docs/content/docs/api/index.mdx@@ -67,7 +67,7 @@ Welcome to the Kaneo API documentation. Explore all available endpoints organize## Authentication-All API endpoints require authentication. Refer to the [authentication documentation](/docs/core) for details on how to authenticate your requests.+All API endpoints require authentication. Refer to the [authentication guide](/docs/api/authentication) for details on how to create and use API keys to authenticate your requests.## Base URLdiff --git a/apps/docs/content/docs/api/meta.json b/apps/docs/content/docs/api/meta.jsonindex 3e5b33419..1cbbed145 100644--- a/apps/docs/content/docs/api/meta.json+++ b/apps/docs/content/docs/api/meta.json@@ -2,6 +2,7 @@"title": "API","description": "The API for Kaneo","pages": [+ "authentication","getConfig","globalSearch","tasks",diff --git a/apps/web/src/components/activity/comment-card.tsx b/apps/web/src/components/activity/comment-card.tsxindex 8a551c6b1..cd187513f 100644--- a/apps/web/src/components/activity/comment-card.tsx+++ b/apps/web/src/components/activity/comment-card.tsx@@ -168,9 +168,8 @@ export default function CommentCard({try {await updateComment({- id: commentId,- userId: currentUser.id,- content: editedContent,+ activityId: commentId,+ comment: editedContent,});setIsEditing(false);@@ -188,9 +187,9 @@ export default function CommentCard({editedContent,updateComment,commentId,- currentUser?.id,queryClient,taskId,+ currentUser?.id,]);useEffect(() => {diff --git a/apps/web/src/components/activity/comment-input.tsx b/apps/web/src/components/activity/comment-input.tsxindex 82f641209..ae7a9fb82 100644--- a/apps/web/src/components/activity/comment-input.tsx+++ b/apps/web/src/components/activity/comment-input.tsx@@ -42,10 +42,9 @@ import { useUserPreferencesStore } from "@/store/user-preferences";interface CommentInputProps {taskId: string;- userId: string;}-export default function CommentInput({ taskId, userId }: CommentInputProps) {+export default function CommentInput({ taskId }: CommentInputProps) {const { theme } = useUserPreferencesStore();const [content, setContent] = useState("");const { mutateAsync: createComment, isPending } = useCreateComment();@@ -78,8 +77,7 @@ export default function CommentInput({ taskId, userId }: CommentInputProps) {try {await createComment({taskId,- userId,- content,+ comment: content,});// Clear editor@@ -95,7 +93,7 @@ export default function CommentInput({ taskId, userId }: CommentInputProps) {console.error("Failed to create comment:", error);toast.error("Failed to add comment");}- }, [content, createComment, taskId, userId, editor, queryClient]);+ }, [content, createComment, taskId, editor, queryClient]);useEffect(() => {const handleKeyDown = (e: KeyboardEvent) => {diff --git a/apps/web/src/fetchers/comment/create-comment.ts b/apps/web/src/fetchers/comment/create-comment.tsindex dc6d7e4c6..e48cf13ca 100644--- a/apps/web/src/fetchers/comment/create-comment.ts+++ b/apps/web/src/fetchers/comment/create-comment.ts@@ -5,16 +5,11 @@ export type CreateCommentRequest = InferRequestType<(typeof client)["activity"]["comment"]["$post"]>["json"];-async function createComment({- taskId,- content,- userId,-}: CreateCommentRequest) {+async function createComment({ taskId, comment }: CreateCommentRequest) {const response = await client.activity.comment.$post({json: {taskId,- content,- userId,+ comment,},});diff --git a/apps/web/src/fetchers/comment/delete-comment.ts b/apps/web/src/fetchers/comment/delete-comment.tsindex c6aca8a9f..ca01fdc23 100644--- a/apps/web/src/fetchers/comment/delete-comment.ts+++ b/apps/web/src/fetchers/comment/delete-comment.ts@@ -5,9 +5,9 @@ export type DeleteCommentRequest = InferRequestType<(typeof client)["activity"]["comment"]["$delete"]>["json"];-async function deleteComment({ id, userId }: DeleteCommentRequest) {+async function deleteComment({ activityId }: DeleteCommentRequest) {const response = await client.activity.comment.$delete({- json: { id, userId },+ json: { activityId },});if (!response.ok) {diff --git a/apps/web/src/fetchers/comment/update-comment.ts b/apps/web/src/fetchers/comment/update-comment.tsindex ac9a09fa4..e9344b53a 100644--- a/apps/web/src/fetchers/comment/update-comment.ts+++ b/apps/web/src/fetchers/comment/update-comment.ts@@ -5,12 +5,11 @@ export type UpdateCommentRequest = InferRequestType<(typeof client)["activity"]["comment"]["$put"]>["json"];-async function updateComment({ id, content, userId }: UpdateCommentRequest) {+async function updateComment({ activityId, comment }: UpdateCommentRequest) {const response = await client.activity.comment.$put({json: {- id,- content,- userId,+ activityId,+ comment,},});diff --git a/apps/web/src/fetchers/time-entry/update-time-entry.ts b/apps/web/src/fetchers/time-entry/update-time-entry.tsindex f9699ee83..935c3dd89 100644--- a/apps/web/src/fetchers/time-entry/update-time-entry.ts+++ b/apps/web/src/fetchers/time-entry/update-time-entry.ts@@ -9,14 +9,16 @@ export type UpdateTimeEntryRequest = InferRequestType<async function updateTimeEntry({id,+ startTime,endTime,- duration,+ description,}: UpdateTimeEntryRequest) {const response = await client["time-entry"][":id"].$put({param: { id },json: {+ startTime,endTime,- duration,+ description,},});