mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-04-19 03:51:31 +00:00
refactor(providers): move auth status routes under provider API
Move provider authentication status endpoints out of the legacy `/api/cli` route namespace so auth status is exposed through the same provider module that owns provider auth and MCP behavior. Add `GET /api/providers/:provider/auth/status` to the provider router and route it through the provider auth service. Remove the old `cli-auth` route file and `/api/cli` mount now that provider auth status is handled by the unified provider API. Update the frontend provider auth endpoint map to call the new provider-scoped routes and rename the endpoint constant to reflect that it is no longer CLI specific.
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
import express from 'express';
|
||||
|
||||
import { providerAuthService } from '../modules/providers/services/provider-auth.service.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
/**
|
||||
* Creates a status route handler for one provider while preserving the existing
|
||||
* /api/cli/<provider>/status endpoint shape.
|
||||
*/
|
||||
function createProviderStatusHandler(providerName) {
|
||||
return async (req, res) => {
|
||||
try {
|
||||
const status = await providerAuthService.getProviderAuthStatus(providerName);
|
||||
return res.json(status);
|
||||
} catch (error) {
|
||||
console.error(`Error checking ${providerName} auth status:`, error);
|
||||
return res.status(500).json({
|
||||
installed: false,
|
||||
provider: providerName,
|
||||
authenticated: false,
|
||||
email: null,
|
||||
method: null,
|
||||
error: error instanceof Error ? error.message : 'Failed to check provider auth status',
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
router.get('/claude/status', createProviderStatusHandler('claude'));
|
||||
router.get('/cursor/status', createProviderStatusHandler('cursor'));
|
||||
router.get('/codex/status', createProviderStatusHandler('codex'));
|
||||
router.get('/gemini/status', createProviderStatusHandler('gemini'));
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user