Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): filter credentials to ones that are supported (#10725)

Nicholas Tindlea54bed6d683f
diff --git a/autogpt_platform/frontend/src/hooks/useCredentials.ts b/autogpt_platform/frontend/src/hooks/useCredentials.ts
index da29b85b1b..64c891b2e3 100644
--- a/autogpt_platform/frontend/src/hooks/useCredentials.ts
+++ b/autogpt_platform/frontend/src/hooks/useCredentials.ts
@@ -94,6 +94,12 @@ export default function useCredentials(
}
const savedCredentials = provider.savedCredentials.filter((c) => {
+ // First, check if the credential type is supported by this block
+ const supportedTypes = credsInputSchema.credentials_types;
+ if (!supportedTypes.includes(c.type)) {
+ return false;
+ }
+
// Filter by OAuth credentials that have sufficient scopes for this block
if (c.type === "oauth2") {
const requiredScopes = credsInputSchema.credentials_scopes;
@@ -108,7 +114,7 @@ export default function useCredentials(
return discriminatorValue && getHostFromUrl(discriminatorValue) == c.host;
}
- // Include all other credential types
+ // Include all other credential types that passed the type check
return true;
});