fix(auth): fix dashboard login with project API keys
validate_key() requires project_id argument but was called without it in dashboard auth. Fixed by passing skip_project_check=True. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -101,9 +101,13 @@ class DashboardAuth:
|
|||||||
|
|
||||||
api_key_manager = get_api_key_manager()
|
api_key_manager = get_api_key_manager()
|
||||||
|
|
||||||
key_info = api_key_manager.validate_key(api_key)
|
# Dashboard login is not project-specific, so skip project check
|
||||||
if key_info and "admin" in key_info.get("scope", "").split():
|
# and require admin scope
|
||||||
return True, "api_key", key_info.get("key_id")
|
key_id = api_key_manager.validate_key(
|
||||||
|
api_key, project_id="*", required_scope="admin", skip_project_check=True
|
||||||
|
)
|
||||||
|
if key_id:
|
||||||
|
return True, "api_key", key_id
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Error checking API key: {e}")
|
logger.warning(f"Error checking API key: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user