You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add OAuth credential support to add identity and outbound auth CLI flags (#416)
* feat: add OAuth credential support to add identity and outbound auth CLI flags
Extend createCredential to support OAuth credentials alongside API keys:
- CreateCredentialConfig is now a discriminated union (ApiKey vs OAuth)
- OAuth writes CLIENT_ID and CLIENT_SECRET to .env.local
- OAuth writes OAuthCredentialProvider config to agentcore.json
Add CLI flags for non-interactive workflows:
- add identity: --type oauth, --discovery-url, --client-id, --client-secret, --scopes
- add gateway-target: --outbound-auth, --credential-name, --oauth-client-id,
--oauth-client-secret, --oauth-discovery-url, --oauth-scopes
- Inline OAuth credential creation when --oauth-* fields provided without --credential-name
Adds 15 new tests covering OAuth credential creation, validation, and edge cases.
* fix: use || instead of ?? for empty string handling and add discoveryUrl validation
* fix: sanitize hyphens in credential env var names for POSIX compliance
* test: update env var expectations for hyphen-to-underscore sanitization
? '--credential-name is required when outbound auth type is API_KEY'
247
+
: `--credential-name or inline OAuth fields (--oauth-client-id, --oauth-client-secret, --oauth-discovery-url) required when outbound auth type is ${options.outboundAuthType}`,
248
+
};
249
+
}
250
+
251
+
// Validate inline OAuth fields are complete
252
+
if(hasInlineOAuth){
253
+
if(!options.oauthClientId)
254
+
return{valid: false,error: '--oauth-client-id is required for inline OAuth credential creation'};
255
+
if(!options.oauthClientSecret)
256
+
return{valid: false,error: '--oauth-client-secret is required for inline OAuth credential creation'};
257
+
if(!options.oauthDiscoveryUrl)
258
+
return{valid: false,error: '--oauth-discovery-url is required for inline OAuth credential creation'};
259
+
try{
260
+
newURL(options.oauthDiscoveryUrl);
261
+
}catch{
262
+
return{valid: false,error: '--oauth-discovery-url must be a valid URL'};
0 commit comments