Skip to content

[Bug]: API Key Management System Incompatibility with Knowhere Backend #35

Description

@kaiyu96

Affected area

API keys

Summary

The Dashboard uses Better Auth's apiKey() plugin for API key management, but this plugin's database schema is incompatible with Knowhere API's native API Key system. This causes critical auth failures when users try to use API keys generated in the Dashboard.

Problems:

  • Better Auth apiKey plugin creates a different schema than expected by Knowhere API
  • API keys created in Dashboard cannot be used to authenticate API requests
  • Users see "Unauthorized" errors despite creating valid API keys
  • The two systems cannot share or validate the same API keys

Root Cause:

In lib/auth.ts, the Better Auth configuration includes:

plugins: [ jwt(), apiKey(), magicLink() ]

But the generated schema doesn't match Knowhere API's api_keys table structure (SHA-256 hashed keys with user_id, key_mask, etc.).

Browser

Chrome

Reproduction steps

/

Screenshots or recordings

No response

Relevant logs


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions