Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(auth): add custom OAuth provider support

Andrej Acevskia566702f6e89
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd8745549..690aeb42a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+## [2.0.8](https://github.com/usekaneo/kaneo/compare/v2.0.7...v2.0.8) (2025-12-09)
+
+
+### Features
+
+* **auth:** add support for custom OAuth/OIDC provider integration ([f67a6f6](https://github.com/usekaneo/kaneo/commit/f67a6f66b61612e13e065e2798a899a9dae44ecc))
+
+
+
## [2.0.7](https://github.com/usekaneo/kaneo/compare/v2.0.6...v2.0.7) (2025-12-08)
diff --git a/apps/api/drizzle/0007_careful_moira_mactaggert.sql b/apps/api/drizzle/0007_careful_moira_mactaggert.sql
new file mode 100644
index 000000000..17c75906b
--- /dev/null
+++ b/apps/api/drizzle/0007_careful_moira_mactaggert.sql
@@ -0,0 +1,53 @@
+-- Rename active_workspace_id to active_organization_id in session table (idempotent)
+DO $$
+BEGIN
+ IF EXISTS (
+ SELECT 1 FROM information_schema.columns
+ WHERE table_name = 'session'
+ AND column_name = 'active_workspace_id'
+ ) THEN
+ ALTER TABLE "session" RENAME COLUMN "active_workspace_id" TO "active_organization_id";
+ END IF;
+END $$;
+--> statement-breakpoint
+-- Drop constraint idempotently
+DO $$
+BEGIN
+ IF EXISTS (
+ SELECT 1 FROM information_schema.table_constraints
+ WHERE constraint_name = 'workspace_member_workspace_id_user_id_unique'
+ AND table_name = 'workspace_member'
+ ) THEN
+ ALTER TABLE "workspace_member" DROP CONSTRAINT "workspace_member_workspace_id_user_id_unique";
+ END IF;
+END $$;
+--> statement-breakpoint
+ALTER TABLE "account" ALTER COLUMN "updated_at" DROP DEFAULT;--> statement-breakpoint
+ALTER TABLE "session" ALTER COLUMN "updated_at" DROP DEFAULT;--> statement-breakpoint
+ALTER TABLE "user" ALTER COLUMN "is_anonymous" SET DEFAULT false;--> statement-breakpoint
+ALTER TABLE "workspace" ALTER COLUMN "slug" SET NOT NULL;--> statement-breakpoint
+ALTER TABLE "workspace" ALTER COLUMN "created_at" DROP DEFAULT;--> statement-breakpoint
+ALTER TABLE "workspace_member" ALTER COLUMN "workspace_id" SET NOT NULL;--> statement-breakpoint
+ALTER TABLE "workspace_member" ALTER COLUMN "joined_at" DROP DEFAULT;--> statement-breakpoint
+-- Add column idempotently
+DO $$
+BEGIN
+ IF NOT EXISTS (
+ SELECT 1 FROM information_schema.columns
+ WHERE table_name = 'invitation'
+ AND column_name = 'created_at'
+ ) THEN
+ ALTER TABLE "invitation" ADD COLUMN "created_at" timestamp DEFAULT now() NOT NULL;
+ END IF;
+END $$;
+--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "account_userId_idx" ON "account" USING btree ("user_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "invitation_workspaceId_idx" ON "invitation" USING btree ("workspace_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "invitation_email_idx" ON "invitation" USING btree ("email");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "session_userId_idx" ON "session" USING btree ("user_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "teamMember_teamId_idx" ON "team_member" USING btree ("team_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "teamMember_userId_idx" ON "team_member" USING btree ("user_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "team_workspaceId_idx" ON "team" USING btree ("workspace_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "verification_identifier_idx" ON "verification" USING btree ("identifier");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "workspace_member_workspaceId_idx" ON "workspace_member" USING btree ("workspace_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "workspace_member_userId_idx" ON "workspace_member" USING btree ("user_id");
diff --git a/apps/api/drizzle/meta/0007_snapshot.json b/apps/api/drizzle/meta/0007_snapshot.json
new file mode 100644
index 000000000..4bb09290b
--- /dev/null
+++ b/apps/api/drizzle/meta/0007_snapshot.json
@@ -0,0 +1,1367 @@
+{
+ "id": "8e96c8e6-f2d0-4265-8207-61a6332b7b0c",
+ "prevId": "2e7cc59a-5fd1-4185-b702-c0a61ac2bc4c",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity": {
+ "name": "activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "activity_task_id_task_id_fk": {
+ "name": "activity_task_id_task_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "activity_user_id_user_id_fk": {
+ "name": "activity_user_id_user_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.github_integration": {
+ "name": "github_integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_owner": {
+ "name": "repository_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_name": {
+ "name": "repository_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_integration_project_id_project_id_fk": {
+ "name": "github_integration_project_id_project_id_fk",
+ "tableFrom": "github_integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "github_integration_project_id_unique": {
+ "name": "github_integration_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "invitation_workspaceId_idx": {
+ "name": "invitation_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_workspace_id_workspace_id_fk": {
+ "name": "invitation_workspace_id_workspace_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": ["inviter_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_task_id_task_id_fk": {
+ "name": "label_task_id_task_id_fk",
+ "tableFrom": "label",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "label_workspace_id_workspace_id_fk": {
+ "name": "label_workspace_id_workspace_id_fk",
+ "tableFrom": "label",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Layout'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_workspace_id_workspace_id_fk": {
+ "name": "project_workspace_id_workspace_id_fk",
+ "tableFrom": "project",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_team_id": {
+ "name": "active_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task": {
+ "name": "task",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'to-do'"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'low'"
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_project_id_project_id_fk": {
+ "name": "task_project_id_project_id_fk",
+ "tableFrom": "task",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "teamMember_teamId_idx": {
+ "name": "teamMember_teamId_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teamMember_userId_idx": {
+ "name": "teamMember_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_workspaceId_idx": {
+ "name": "team_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.time_entry": {
+ "name": "time_entry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "time_entry_task_id_task_id_fk": {
+ "name": "time_entry_task_id_task_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "time_entry_user_id_user_id_fk": {
+ "name": "time_entry_user_id_user_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_anonymous": {
+ "name": "is_anonymous",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_member": {
+ "name": "workspace_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "workspace_member_workspaceId_idx": {
+ "name": "workspace_member_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_member_userId_idx": {
+ "name": "workspace_member_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_member_workspace_id_workspace_id_fk": {
+ "name": "workspace_member_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_member_user_id_user_id_fk": {
+ "name": "workspace_member_user_id_user_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json
index 13b87575e..04091ed55 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -50,6 +50,13 @@
"when": 1733703124000,
"tag": "0006_rename_active_workspace_to_organization",
"breakpoints": true
+ },
+ {
+ "idx": 7,
+ "version": "7",
+ "when": 1765390825431,
+ "tag": "0007_careful_moira_mactaggert",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/activity/controllers/get-activities.ts b/apps/api/src/activity/controllers/get-activities.ts
index c16bdcf4a..6e5b3c020 100644
--- a/apps/api/src/activity/controllers/get-activities.ts
+++ b/apps/api/src/activity/controllers/get-activities.ts
@@ -7,6 +7,13 @@ async function getActivitiesFromTaskId(taskId: string) {
where: eq(activityTable.taskId, taskId),
orderBy: [desc(activityTable.createdAt)],
});
+
+ activities.forEach((x) => {
+ if (x.content) {
+ x.content = x.content.replace(/\n+/g, "\n");
+ }
+ });
+
return activities;
}
diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.ts
index d5444b253..e40efd14c 100644
--- a/apps/api/src/auth.ts
+++ b/apps/api/src/auth.ts
@@ -5,6 +5,7 @@ import { drizzleAdapter } from "better-auth/adapters/drizzle";
import {
anonymous,
createAuthMiddleware,
+ genericOAuth,
lastLoginMethod,
magicLink,
organization,
@@ -178,6 +179,22 @@ export const auth = betterAuth({
);
},
}),
+ genericOAuth({
+ config: [
+ {
+ providerId: "custom",
+ clientId: process.env.CUSTOM_OAUTH_CLIENT_ID || "",
+ clientSecret: process.env.CUSTOM_OAUTH_CLIENT_SECRET,
+ authorizationUrl: process.env.CUSTOM_OAUTH_AUTHORIZATION_URL || "",
+ tokenUrl: process.env.CUSTOM_OAUTH_TOKEN_URL || "",
+ userInfoUrl: process.env.CUSTOM_OAUTH_USER_INFO_URL || "",
+ scopes: process.env.CUSTOM_OAUTH_SCOPES?.split(",") || [],
+ responseType: process.env.CUSTOM_OAUTH_RESPONSE_TYPE || "code",
+ discoveryUrl: process.env.CUSTOM_OAUTH_DISCOVERY_URL || "",
+ pkce: process.env.CUSTOM_AUTH_PKCE !== "false",
+ },
+ ],
+ }),
],
session: {
cookieCache: {
diff --git a/apps/api/src/task/controllers/get-task.ts b/apps/api/src/task/controllers/get-task.ts
index f50f7a37a..9c66631ac 100644
--- a/apps/api/src/task/controllers/get-task.ts
+++ b/apps/api/src/task/controllers/get-task.ts
@@ -31,6 +31,10 @@ async function getTask(taskId: string) {
});
}
+ if (task[0].description) {
+ task[0].description = task[0].description.replace(/\n+/g, "\n");
+ }
+
return task[0];
}
diff --git a/apps/api/src/utils/get-settings.ts b/apps/api/src/utils/get-settings.ts
index e23ce5daf..8c02cee63 100644
--- a/apps/api/src/utils/get-settings.ts
+++ b/apps/api/src/utils/get-settings.ts
@@ -18,6 +18,9 @@ function getSettings() {
hasGoogleSignIn:
Boolean(process.env.GOOGLE_CLIENT_ID) &&
Boolean(process.env.GOOGLE_CLIENT_SECRET),
+ hasCustomOAuth:
+ Boolean(process.env.CUSTOM_OAUTH_CLIENT_ID) &&
+ Boolean(process.env.CUSTOM_OAUTH_CLIENT_SECRET),
};
}
diff --git a/apps/docs/content/docs/installation/environment-variables.mdx b/apps/docs/content/docs/installation/environment-variables.mdx
index 301e074d7..c63e4a223 100644
--- a/apps/docs/content/docs/installation/environment-variables.mdx
+++ b/apps/docs/content/docs/installation/environment-variables.mdx
@@ -13,6 +13,8 @@ The variables are split up into the following sections:
- [Database](#database)
- [Authentication](#authentication)
- [GitHub SSO & Integration](#github-sso-&-integration)
+- [Google SSO](#google-sso)
+- [Custom OAuth/OIDC](#custom-oauth-oidc)
- [SMTP Configuration](#smtp-configuration)
## Required variables
@@ -58,13 +60,27 @@ Name | Description |
| `GITHUB_WEBHOOK_SECRET` | The GitHub webhook secret.
| `GITHUB_PRIVATE_KEY` | The GitHub private key.
-### Google SSO & Integration
+### Google SSO
Name | Description |
--- | --- |
| `GOOGLE_CLIENT_ID` | The Google client ID.
| `GOOGLE_CLIENT_SECRET` | The Google client secret.
+### Custom OAuth/OIDC
+
+Name | Description |
+--- | --- |
+| `CUSTOM_OAUTH_CLIENT_ID` | OAuth client ID from your provider.
+| `CUSTOM_OAUTH_CLIENT_SECRET` | OAuth client secret from your provider.
+| `CUSTOM_OAUTH_AUTHORIZATION_URL` | Authorization endpoint URL.
+| `CUSTOM_OAUTH_TOKEN_URL` | Token exchange endpoint URL.
+| `CUSTOM_OAUTH_USER_INFO_URL` | User info endpoint URL.
+| `CUSTOM_OAUTH_DISCOVERY_URL` | (Optional) OpenID Connect discovery document URL.
+| `CUSTOM_OAUTH_SCOPES` | (Optional) Comma-separated list of OAuth scopes. Default: `profile,email`.
+| `CUSTOM_OAUTH_RESPONSE_TYPE` | (Optional) OAuth response type. Default: `code`.
+| `CUSTOM_AUTH_PKCE` | (Optional) Enable/disable PKCE. Default: `true`.
+
### SMTP Configuration
Name | Description |
@@ -79,6 +95,7 @@ Name | Description |
## Key points
-- If you enable GitHub SSO, you need to set up the GitHub app which is used to authenticate users in the [GitHub Developer Settings](https://github.com/settings/developers).
-- If you enable Google SSO, you need to set up the Google app which is used to authenticate users in the [Google Cloud Console](https://console.cloud.google.com/).
+- If you enable GitHub SSO, you need to set up the GitHub app which is used to authenticate users in the [GitHub Developer Settings](https://github.com/settings/developers). See the [GitHub SSO guide](/docs/social-providers/github).
+- If you enable Google SSO, you need to set up the Google app which is used to authenticate users in the [Google Cloud Console](https://console.cloud.google.com/). See the [Google SSO guide](/docs/social-providers/google).
+- If you enable Custom OAuth/OIDC, you need to configure your identity provider with the appropriate redirect URI. See the [Custom OAuth/OIDC guide](/docs/social-providers/custom-oauth).
- If you have enabled SMTP, your sign in will be done via email using a magic link.
diff --git a/apps/docs/content/docs/social-providers/custom-oauth.mdx b/apps/docs/content/docs/social-providers/custom-oauth.mdx
new file mode 100644
index 000000000..dcdfaf51c
--- /dev/null
+++ b/apps/docs/content/docs/social-providers/custom-oauth.mdx
@@ -0,0 +1,170 @@
+---
+title: Custom OAuth/OIDC
+description: Configure Kaneo with your custom OpenID Connect (OIDC) provider.
+---
+
+## Overview
+
+Kaneo supports custom OAuth 2.0 and OpenID Connect (OIDC) providers, allowing you to integrate with any standards-compliant identity provider such as Keycloak, Auth0, Okta, Azure AD, or self-hosted solutions like Pocket ID.
+
+## Configuration
+
+To configure a custom OAuth/OIDC provider, you need to set the following environment variables in your `.env` file:
+
+### Required Variables
+
+| Variable | Description | Example |
+|----------|-------------|---------|
+| `CUSTOM_OAUTH_CLIENT_ID` | OAuth client ID from your provider | `2b1ae9df-8d25-4dbc-8cc8-f8f2c1ef6bd0` |
+| `CUSTOM_OAUTH_CLIENT_SECRET` | OAuth client secret from your provider | `NzDjplDsdQyP062wTmkZ8kyiaziBag0N` |
+| `CUSTOM_OAUTH_AUTHORIZATION_URL` | Authorization endpoint URL | `https://id.example.com/authorize` |
+| `CUSTOM_OAUTH_TOKEN_URL` | Token exchange endpoint URL | `https://id.example.com/api/oidc/token` |
+| `CUSTOM_OAUTH_USER_INFO_URL` | User info endpoint URL | `https://id.example.com/api/oidc/userinfo` |
+
+### Optional Variables
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `CUSTOM_OAUTH_DISCOVERY_URL` | OpenID Connect discovery document URL | - |
+| `CUSTOM_OAUTH_SCOPES` | Comma-separated list of OAuth scopes | `profile,email` |
+| `CUSTOM_OAUTH_RESPONSE_TYPE` | OAuth response type | `code` |
+| `CUSTOM_AUTH_PKCE` | Enable/disable PKCE (Proof Key for Code Exchange) | `true` |
+
+## Setup Steps
+
+### 1. Configure Your OAuth Provider
+
+First, create an OAuth 2.0 or OIDC application in your identity provider:
+
+1. Log in to your identity provider's admin console
+2. Create a new OAuth 2.0 or OIDC application
+3. Set the redirect URI to: `{KANEO_API_URL}/api/auth/callback/custom`
+ - Example: `https://api.kaneo.example.com/api/auth/callback/custom`
+4. Copy the client ID and client secret
+5. Note the authorization, token, and userinfo endpoint URLs
+
+### 2. Set Environment Variables
+
+Add the following to your `.env` file:
+
+```bash
+# Custom OAuth/OIDC Configuration
+CUSTOM_OAUTH_CLIENT_ID=your-client-id
+CUSTOM_OAUTH_CLIENT_SECRET=your-client-secret
+CUSTOM_OAUTH_AUTHORIZATION_URL=https://your-idp.com/authorize
+CUSTOM_OAUTH_TOKEN_URL=https://your-idp.com/oauth/token
+CUSTOM_OAUTH_USER_INFO_URL=https://your-idp.com/oauth/userinfo
+
+# Optional: Use discovery URL for automatic configuration
+CUSTOM_OAUTH_DISCOVERY_URL=https://your-idp.com/.well-known/openid-configuration
+
+# Optional: Customize scopes
+CUSTOM_OAUTH_SCOPES=profile,email,openid
+
+# Optional: Disable PKCE if your provider doesn't support it
+CUSTOM_AUTH_PKCE=false
+```
+
+### 3. Restart Services
+
+After updating the environment variables, restart your Kaneo services:
+
+```bash
+docker compose restart
+```
+
+## Example Configurations
+
+### Pocket ID
+
+```bash
+CUSTOM_OAUTH_CLIENT_ID=2b1ae9df-8d25-4dbc-8cc8-f8f2c1ef6bd0
+CUSTOM_OAUTH_CLIENT_SECRET=NzDjplDsdQyP062wTmkZ8kyiaziBag0N
+CUSTOM_OAUTH_AUTHORIZATION_URL=https://4c6332d2.demo.pocket-id.org/authorize
+CUSTOM_OAUTH_TOKEN_URL=https://4c6332d2.demo.pocket-id.org/api/oidc/token
+CUSTOM_OAUTH_USER_INFO_URL=https://4c6332d2.demo.pocket-id.org/api/oidc/userinfo
+CUSTOM_OAUTH_DISCOVERY_URL=https://4c6332d2.demo.pocket-id.org/.well-known/openid-configuration
+CUSTOM_OAUTH_SCOPES=profile,email
+```
+
+### Keycloak
+
+```bash
+CUSTOM_OAUTH_CLIENT_ID=kaneo-client
+CUSTOM_OAUTH_CLIENT_SECRET=your-secret-here
+CUSTOM_OAUTH_DISCOVERY_URL=https://keycloak.example.com/realms/your-realm/.well-known/openid-configuration
+CUSTOM_OAUTH_SCOPES=openid,profile,email
+```
+
+### Auth0
+
+```bash
+CUSTOM_OAUTH_CLIENT_ID=your-client-id
+CUSTOM_OAUTH_CLIENT_SECRET=your-client-secret
+CUSTOM_OAUTH_AUTHORIZATION_URL=https://your-tenant.auth0.com/authorize
+CUSTOM_OAUTH_TOKEN_URL=https://your-tenant.auth0.com/oauth/token
+CUSTOM_OAUTH_USER_INFO_URL=https://your-tenant.auth0.com/userinfo
+CUSTOM_OAUTH_SCOPES=openid,profile,email
+```
+
+## Usage
+
+Once configured, users will see a "Continue with OIDC" button on the sign-in page. The system will automatically remember the last used login method for each user.
+
+## Troubleshooting
+
+### "Invalid code verifier" Error
+
+This error typically indicates a PKCE configuration issue. Try setting:
+
+```bash
+CUSTOM_AUTH_PKCE=false
+```
+
+Some OAuth providers don't support PKCE or have it disabled by default.
+
+### Missing User Information
+
+Ensure your OAuth scopes include at least `profile` and `email`:
+
+```bash
+CUSTOM_OAUTH_SCOPES=profile,email
+```
+
+Some providers require `openid` scope as well:
+
+```bash
+CUSTOM_OAUTH_SCOPES=openid,profile,email
+```
+
+### Redirect URI Mismatch
+
+Verify that your redirect URI in the OAuth provider matches exactly:
+
+```
+{KANEO_API_URL}/api/auth/callback/custom
+```
+
+For example, if `KANEO_API_URL=https://api.kaneo.example.com`, the redirect URI should be:
+
+```
+https://api.kaneo.example.com/api/auth/callback/custom
+```
+
+## Discovery URL
+
+If your provider supports OpenID Connect, you can use the discovery URL to automatically configure most settings:
+
+```bash
+CUSTOM_OAUTH_DISCOVERY_URL=https://your-idp.com/.well-known/openid-configuration
+```
+
+This will automatically discover the authorization, token, and userinfo endpoints. However, you still need to provide the client ID and secret.
+
+## Security Notes
+
+- Always use HTTPS in production
+- Keep your client secret secure and never commit it to version control
+- Enable PKCE when possible for enhanced security
+- Use the most restrictive scopes necessary for your use case
+
diff --git a/apps/docs/content/docs/social-providers/meta.json b/apps/docs/content/docs/social-providers/meta.json
index edde9a862..6e55140e8 100644
--- a/apps/docs/content/docs/social-providers/meta.json
+++ b/apps/docs/content/docs/social-providers/meta.json
@@ -1,6 +1,6 @@
{
"title": "Social Providers",
"icon": "Users",
- "pages": ["github", "google"],
+ "pages": ["github", "google", "custom-oauth"],
"defaultOpen": true
}
diff --git a/apps/docs/next-env.d.ts b/apps/docs/next-env.d.ts
index 9edff1c7c..c4b7818fb 100644
--- a/apps/docs/next-env.d.ts
+++ b/apps/docs/next-env.d.ts
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
-import "./.next/types/routes.d.ts";
+import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/web/src/components/auth/toggle.tsx b/apps/web/src/components/auth/toggle.tsx
index 10b15b841..1103d706e 100644
--- a/apps/web/src/components/auth/toggle.tsx
+++ b/apps/web/src/components/auth/toggle.tsx
@@ -15,7 +15,7 @@ export function AuthToggle({ message, linkText, linkTo }: AuthToggleProps) {
}
return (
- <div className="text-center text-sm text-muted-foreground">
+ <div className="text-center text-sm text-muted-foreground mt-3">
{message}{" "}
<Link
to={linkTo}
diff --git a/apps/web/src/lib/auth-client.ts b/apps/web/src/lib/auth-client.ts
index e8dbb86a9..fbf30baa5 100644
--- a/apps/web/src/lib/auth-client.ts
+++ b/apps/web/src/lib/auth-client.ts
@@ -1,5 +1,6 @@
import {
anonymousClient,
+ genericOAuthClient,
lastLoginMethodClient,
magicLinkClient,
organizationClient,
@@ -32,5 +33,6 @@ export const authClient = createAuthClient({
owner,
},
}),
+ genericOAuthClient(),
],
});
diff --git a/apps/web/src/routes/auth/sign-in.tsx b/apps/web/src/routes/auth/sign-in.tsx
index 921d22501..ccfbb8a63 100644
--- a/apps/web/src/routes/auth/sign-in.tsx
+++ b/apps/web/src/routes/auth/sign-in.tsx
@@ -1,5 +1,5 @@
import { createFileRoute, useNavigate } from "@tanstack/react-router";
-import { Github, UserCheck } from "lucide-react";
+import { Github, KeyRound, UserCheck } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import PageTitle from "@/components/page-title";
@@ -19,9 +19,10 @@ export const Route = createFileRoute("/auth/sign-in")({
function SignIn() {
const navigate = useNavigate();
- const [isGuestLoading, setIsGuestLoading] = useState(false);
+ const [isCustomOAuthLoading, setIsCustomOAuthLoading] = useState(false);
const [isGithubLoading, setIsGithubLoading] = useState(false);
const [isGoogleLoading, setIsGoogleLoading] = useState(false);
+ const [isGuestLoading, setIsGuestLoading] = useState(false);
const lastLoginMethod = authClient.getLastUsedLoginMethod();
const { data: config, isLoading: isConfigLoading } = useGetConfig();
@@ -43,6 +44,28 @@ function SignIn() {
}
};
+ const handleCustomOAuth = async () => {
+ setIsCustomOAuthLoading(true);
+ try {
+ const result = await authClient.signIn.oauth2({
+ providerId: "custom",
+ callbackURL: `${import.meta.env.VITE_CLIENT_URL}/dashboard`,
+ errorCallbackURL: `${import.meta.env.VITE_CLIENT_URL}/auth/sign-in`,
+ });
+ if (result.error) {
+ throw new Error(result.error.message);
+ }
+ toast.success("Signed in with OIDC");
+ navigate({ to: "/dashboard" });
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to sign in with OIDC",
+ );
+ } finally {
+ setIsCustomOAuthLoading(false);
+ }
+ };
+
const handleSignInGoogle = async () => {
setIsGoogleLoading(true);
try {
@@ -58,10 +81,12 @@ function SignIn() {
navigate({ to: "/dashboard" });
} catch (error) {
toast.error(
- error instanceof Error ? error.message : "Failed to sign in as guest",
+ error instanceof Error
+ ? error.message
+ : "Failed to sign in with Google",
);
} finally {
- setIsGuestLoading(false);
+ setIsGoogleLoading(false);
}
};
@@ -111,70 +136,116 @@ function SignIn() {
title="Welcome back"
subtitle="Enter your credentials to access your workspace"
>
- <div className="space-y-4 mt-6">
- <div className="flex flex-col gap-2">
- <div className="relative">
- {config?.hasGoogleSignIn && (
- <Button
- variant="outline"
- onClick={handleSignInGoogle}
- disabled={isGoogleLoading}
- className={cn(
- "w-full mb-2",
- lastLoginMethod === "google" && "!border-primary/50",
- )}
- >
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
- <title>Google</title>
- <path
- d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"
- fill="currentColor"
- />
- </svg>
- {isGoogleLoading ? "Signing in..." : "Continue with Google"}
- {lastLoginMethod === "google" && (
- <span className="absolute rounded-md -top-3 right-1 px-1.5 text-xs text-primary font-medium bg-sidebar border border-primary/50">
- Last used
- </span>
- )}
- </Button>
- )}
- {config?.hasGithubSignIn && (
+ <div className="mt-6">
+ {(config?.hasGoogleSignIn ||
+ config?.hasGithubSignIn ||
+ config?.hasCustomOAuth) && (
+ <>
+ <div className="space-y-3">
+ {config?.hasGoogleSignIn && (
+ <div className="relative">
+ <Button
+ variant="outline"
+ onClick={handleSignInGoogle}
+ disabled={isGoogleLoading}
+ className={cn(
+ "w-full",
+ lastLoginMethod === "google" && "border-primary/50!",
+ )}
+ >
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ className="w-5 h-5 mr-2"
+ aria-label="Google"
+ >
+ <title>Google</title>
+ <path
+ d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z"
+ fill="currentColor"
+ />
+ </svg>
+ {isGoogleLoading
+ ? "Signing in..."
+ : "Continue with Google"}
+ </Button>
+ {lastLoginMethod === "google" && (
+ <span className="absolute rounded-md -top-3 right-1 px-1.5 text-xs text-primary font-medium bg-sidebar border border-primary/50">
+ Last used
+ </span>
+ )}
+ </div>
+ )}
+
+ {config?.hasGithubSignIn && (
+ <div className="relative">
+ <Button
+ variant="outline"
+ onClick={handleSignInGithub}
+ disabled={isGithubLoading}
+ className={cn(
+ "w-full",
+ lastLoginMethod === "github" && "border-primary/50!",
+ )}
+ >
+ <Github className="w-5 h-5 mr-2" />
+ {isGithubLoading
+ ? "Signing in..."
+ : "Continue with GitHub"}
+ </Button>
+ {lastLoginMethod === "github" && (
+ <span className="absolute rounded-md -top-3 right-1 px-1.5 text-xs text-primary font-medium bg-sidebar border border-primary/50">
+ Last used
+ </span>
+ )}
+ </div>
+ )}
+
+ {config?.hasCustomOAuth && (
+ <div className="relative">
+ <Button
+ variant="outline"
+ onClick={handleCustomOAuth}
+ disabled={isCustomOAuthLoading}
+ className={cn(
+ "w-full",
+ lastLoginMethod === "custom" && "border-primary/50!",
+ )}
+ >
+ <KeyRound className="w-5 h-5 mr-2" />
+ {isCustomOAuthLoading
+ ? "Signing in..."
+ : "Continue with OIDC"}
+ </Button>
+ {lastLoginMethod === "custom" && (
+ <span className="absolute rounded-md -top-3 right-1 px-1.5 text-xs text-primary font-medium bg-sidebar border border-primary/50">
+ Last used
+ </span>
+ )}
+ </div>
+ )}
+
<Button
variant="outline"
- onClick={handleSignInGithub}
- disabled={isGithubLoading}
- className={cn(
- "w-full",
- lastLoginMethod === "github" && "!border-primary/50",
- )}
+ onClick={handleGuestAccess}
+ disabled={isGuestLoading}
+ className="w-full"
>
- <Github className="w-4 h-4 mr-2" />
- {isGithubLoading ? "Signing in..." : "Continue with GitHub"}
- {lastLoginMethod === "github" && (
- <span className="absolute rounded-md -top-3 right-1 px-1.5 text-xs text-primary font-medium bg-sidebar border border-primary/50">
- Last used
- </span>
- )}
+ <UserCheck className="w-4 h-4 mr-2" />
+ {isGuestLoading ? "Signing in..." : "Continue as guest"}
</Button>
- )}
- </div>
- <Button
- variant="outline"
- onClick={handleGuestAccess}
- disabled={isGuestLoading}
- className="w-full"
- size="sm"
- >
- <UserCheck className="w-4 h-4 mr-2" />
- {isGuestLoading ? "Signing in..." : "Continue as guest"}
- </Button>
- </div>
- <div className="flex items-center gap-4 my-4">
- <div className="flex-1 h-px bg-border" />
- <span className="text-sm text-muted-foreground">or</span>
- <div className="flex-1 h-px bg-border" />
- </div>
+ </div>
+
+ <div className="relative my-6">
+ <div className="absolute inset-0 flex items-center">
+ <div className="w-full border-t border-border" />
+ </div>
+ <div className="relative flex justify-center text-sm">
+ <span className="px-2 bg-card text-muted-foreground">or</span>
+ </div>
+ </div>
+ </>
+ )}
{config?.hasSmtp ? <MagicLinkSignInForm /> : <SignInForm />}
<AuthToggle
message="Don't have an account?"
diff --git a/package.json b/package.json
index 71911c4fa..7c0f908cd 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"node": ">=18"
},
"packageManager": "[email protected]",
- "version": "2.0.7",
+ "version": "2.0.8",
"dependencies": {
"dotenv-mono": "^1.5.1"
}