feat: add edit functionality for OAuth metadata fields#1336
feat: add edit functionality for OAuth metadata fields#1336simplesagar wants to merge 3 commits intomainfrom
Conversation
Add ability to update OAuth configuration without deleting and re-adding: - Add updateExternalOAuthServer and updateOAuthProxyServer API endpoints - Add edit button and inline editing UI in OAuthDetailsModal - Support editing authorization endpoint, token endpoint, scopes, auth method, and environment Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 31b8a18 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| export type UpdateExternalOAuthServerRequestBody = { | ||
| /** | ||
| * The updated metadata for the external OAuth server | ||
| */ | ||
| metadata?: any | undefined; | ||
| }; | ||
|
|
||
| /** @internal */ | ||
| export type UpdateExternalOAuthServerRequestBody$Outbound = { | ||
| metadata?: any | undefined; | ||
| }; | ||
|
|
||
| /** @internal */ | ||
| export const UpdateExternalOAuthServerRequestBody$outboundSchema: z.ZodType< | ||
| UpdateExternalOAuthServerRequestBody$Outbound, | ||
| z.ZodTypeDef, | ||
| UpdateExternalOAuthServerRequestBody | ||
| > = z.object({ | ||
| metadata: z.any().optional(), | ||
| }); |
There was a problem hiding this comment.
🟡 UpdateExternalOAuthServerRequestBody marks metadata optional despite API requiring it
The OpenAPI schema for UpdateExternalOAuthServerRequestBody marks metadata as required, but the generated TypeScript model makes it optional:
export type UpdateExternalOAuthServerRequestBody = {
metadata?: any | undefined;
};client/sdk/src/models/components/updateexternaloauthserverrequestbody.ts:8-13
This violates the API contract: SDK consumers can construct requests without metadata, which will then fail server-side validation at runtime.
Actual: SDK allows omitting metadata.
Expected: metadata should be required in the SDK type and validation schema.
Recommendation: Regenerate/fix the OpenAPI->SDK generation so metadata is required (remove .optional() and make the TS field non-optional).
Was this helpful? React with 👍 or 👎 to provide feedback.
…m providers Addresses Devin review feedback: OAuth proxy update could persist empty endpoints because the server didn't validate that authorization_endpoint and token_endpoint are non-empty strings for custom provider types. This adds validation that matches the AddOAuthProxyServer behavior, rejecting requests that provide empty strings for these required fields. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Addressed Devin Review FeedbackIssue 1 (🔴 Empty endpoints): Fixed in commit 31b8a18. Added server-side validation in Issue 2 (🟡 SDK metadata optional): The Goa design correctly marks |
| setJsonError(null); | ||
| updateExternalOAuthMutation.mutate({ | ||
| request: { | ||
| slug: toolset.slug, | ||
| metadata: parsedMetadata, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
🔴 Dashboard calls updateExternalOAuthServer with wrong request shape (missing updateExternalOAuthServerRequestBody wrapper)
The generated SDK operation updateExternalOAuthServer expects the JSON body under updateExternalOAuthServerRequestBody (see generated operation docs/types), but the dashboard mutation sends metadata at the top-level of request.
Code:
updateExternalOAuthMutation.mutate({
request: {
slug: toolset.slug,
metadata: parsedMetadata,
},
});client/dashboard/src/pages/mcp/MCPDetails.tsx:883-889
Actual behavior: the SDK will serialize a request body where UpdateExternalOAuthServerRequestBody is undefined (or omit it), causing client-side validation failures or a server 400/422 because the required metadata body field is missing.
Expected behavior: pass updateExternalOAuthServerRequestBody: { metadata: parsedMetadata } (and keep slug in the query).
Recommendation: Change the mutate call to:
updateExternalOAuthMutation.mutate({
request: {
slug: toolset.slug,
updateExternalOAuthServerRequestBody: { metadata: parsedMetadata },
},
});Was this helpful? React with 👍 or 👎 to provide feedback.
|
|
||
| updateOAuthProxyMutation.mutate({ | ||
| request: { | ||
| slug: toolset.slug, | ||
| authorizationEndpoint: proxyAuthorizationEndpoint, | ||
| tokenEndpoint: proxyTokenEndpoint, | ||
| scopesSupported: scopesArray, | ||
| tokenEndpointAuthMethodsSupported: [proxyTokenAuthMethod], | ||
| environmentSlug: proxyEnvironmentSlug, | ||
| }, |
There was a problem hiding this comment.
🔴 Dashboard calls updateOAuthProxyServer with wrong request shape (missing updateOAuthProxyServerRequestBody wrapper)
The generated SDK operation updateOAuthProxyServer expects the JSON body under updateOAuthProxyServerRequestBody, but the dashboard mutation sends OAuth proxy fields at the top-level of request.
Code:
updateOAuthProxyMutation.mutate({
request: {
slug: toolset.slug,
authorizationEndpoint: proxyAuthorizationEndpoint,
tokenEndpoint: proxyTokenEndpoint,
scopesSupported: scopesArray,
tokenEndpointAuthMethodsSupported: [proxyTokenAuthMethod],
environmentSlug: proxyEnvironmentSlug,
},
});client/dashboard/src/pages/mcp/MCPDetails.tsx:897-906
Actual behavior: the SDK will serialize an empty/incorrect request body because UpdateOAuthProxyServerRequestBody is not provided, leading to client-side validation errors or server rejecting the request / not applying updates.
Expected behavior: wrap those fields in updateOAuthProxyServerRequestBody: { ... }.
Recommendation: Change the mutate call to:
updateOAuthProxyMutation.mutate({
request: {
slug: toolset.slug,
updateOAuthProxyServerRequestBody: {
authorizationEndpoint: proxyAuthorizationEndpoint,
tokenEndpoint: proxyTokenEndpoint,
scopesSupported: scopesArray,
tokenEndpointAuthMethodsSupported: [proxyTokenAuthMethod],
environmentSlug: proxyEnvironmentSlug,
},
},
});Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
updateExternalOAuthServerAPI endpoint to update external OAuth server metadataupdateOAuthProxyServerAPI endpoint to update OAuth proxy configurationauthorization_endpointandtoken_endpointfor custom OAuth proxy providersTest plan
Closes AGE-1215
🤖 Generated with Claude Code