-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi! I have an openapi.json with the following security scheme:
"components": {
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://example.com/oauth/authorize",
"tokenUrl": "https://example.com/oauth/token",
"scopes": {
"read": "Grants read access",
"write": "Grants write access",
"admin": "Grants access to admin operations"
}
}
}
}
},
"schemas": {}
},and one of the endpoint uses it like this
"/example/{id}": {
"get": {
"parameters": [
{
"schema": {
"minLength": 1,
"type": "string"
},
"in": "path",
"name": "id",
"required": true
}
],
"security": [
{
"OAuth2": [
"read"
]
}
]
}I'm also extending fetch to add an interceptor for Auth:
export const fetchWithInterceptor = (input: URL | RequestInfo, options?: RequestInit | undefined) => {
const token = getAuthToken();
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
...options?.headers,
};
return fetch(input, {
...options,
headers,
});
};
const client = createClient({
schema,
baseUrl: 'https://example.com',
fetch: fetchWithInterceptor
})However, it seems like securitySchemes is ignored, so I'm not able to get authorizationCode details to properly create the interceptor, since some endpoints use different schemas.
Any thoughts on how I should implement Authentication?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels