fix(credentials): guard optional auth/provider when resolving credentials
- oauth-login-service.start: require definition.auth to be present and oauth kind before dispatching; captures oauthId in a local so the rest of the flow does not re-assert the nullable chain - ipc-credentials-handlers save: reject connectors without an auth schema instead of crashing on property access - ipc-credentials-handlers test: require provider and defaultModel to be set before calling into pi-ai, returning a diagnostic result otherwise
This commit is contained in:
1 parent
2b63588604
commit
bee5535349
2 files changed
+18
-6
No files matched your search
@@ -31,12 +31,13 @@ export class OAuthLoginService {
|
||||
|
||||
async start(connectorId: string): Promise<void> {
|
||||
const definition = getConnectorDefinition(connectorId);
|
||||
if (definition.auth.type !== "oauth") {
|
||||
if (!definition.auth || definition.auth.type !== "oauth" || !definition.auth.oauthId) {
|
||||
throw new Error(`Connector ${connectorId} does not use OAuth.`);
|
||||
}
|
||||
const provider = getOAuthProvider(definition.auth.oauthId);
|
||||
const oauthId = definition.auth.oauthId;
|
||||
const provider = getOAuthProvider(oauthId);
|
||||
if (!provider) {
|
||||
throw new Error(`Unknown OAuth provider: ${definition.auth.oauthId}`);
|
||||
throw new Error(`Unknown OAuth provider: ${oauthId}`);
|
||||
}
|
||||
|
||||
if (this.active.has(connectorId)) {
|
||||
|
||||
Reference in new issue
Block a user