-
Notifications
You must be signed in to change notification settings - Fork 297
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When an endpoint requires multiple auth schemes (e.g. API Key + OAuth), the code snippet placeholders show the wrong name.
Expected behavior
OAuth token placeholder should show the OAuth scheme's name (e.g. <ACCESS_TOKEN>).
Current behavior
OAuth token placeholder shows the API Key's name (e.g. <X-API-Key>).
Possible solution
In CodeSnippets/index.tsx, change authOptions?.[0]?.name to authOptions?.find((opt) => opt.key === key)?.name.
Steps to reproduce
- Define two security schemes: APIKey and OAuth
- Create an endpoint requiring both:
security: [{ "APIKey": [], "OAuth": [] }]
{
"openapi": "3.0.0",
"info": {
"title": "Test API",
"version": "1.0.0"
},
"paths": {
"/test": {
"get": {
"summary": "Test endpoint",
"security": [
{
"APIKey": [],
"OAuth": []
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"components": {
"securitySchemes": {
"APIKey": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
},
"OAuth": {
"type": "oauth2",
"name": "ACCESS_TOKEN",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://example.com/oauth/authorize",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {}
}
}
}
}
}
}
- View the example in docs
- OAuth header shows
Authorization: Bearer <X-API-Key>instead of the OAuth scheme's name
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working