mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): filter credentials to ones that are supported (#10725)
<!-- Clearly explain the need for these changes: --> We're showing invalid credential types on the selections across the app ### Changes 🏗️ We go from (incorrect) <img width="2551" height="1202" alt="image" src="https://github.com/user-attachments/assets/e566ed6c-b6c9-4047-80fd-0f2c8cef0bf9" /> to this with the fix <img width="2551" height="1202" alt="image" src="https://github.com/user-attachments/assets/c720a3d4-9c03-48c5-82a3-d30752bce13c" /> <!-- Concisely describe all of the changes made in this pull request: --> ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] test the broken agent and upload images proving its no longer broken
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user