Skip to content

Conversation

@Revisto
Copy link

@Revisto Revisto commented Dec 2, 2025

Description

Changed authOptions?.[0]?.name to authOptions?.find((opt: any) => opt.key === key)?.name to find the correct auth scheme by key instead of always picking the first one.

Motivation and Context

Fixes #1255

When an endpoint requires multiple auth schemes together (e.g. API Key + OAuth), the code snippet placeholder was always using the first scheme's name. This caused OAuth Bearer token to show <X-API-Key> instead of the OAuth scheme's configured name.

How Has This Been Tested?

Tested locally with an OpenAPI spec that has both APIKey and OAuth security schemes required together on an endpoint. Verified the example now shows the correct placeholder for each scheme.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [] I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

- Update the placeholder assignment logic to use find method for better accuracy.
- Ensure the correct name is retrieved based on the key from authOptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code snippet shows wrong placeholder when multiple auth schemes are required

1 participant