Open JonathanNathanson opened 4 months ago
Are these included in the schema file?
security:
- bearerAuth: []
I can't seem to trace down the code which is ignoring the auth_settings. There appears to be no other code that references auth['bearerAuth']
Probably does not generate auth['bearerAuth']
even when configured correctly.
Instead, these are generated:
# ./api/default_api.py
def _get_building_by_id_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
...
_auth_settings: List[str] = [
'bearerAuth'
]
Yes, the scehma includes.
security:
- bearerAuth: []
So is the behaviour I'm witnessing expected? How should I use an access_token? Currently the workaround is to set the header manually.
We are seing this issue as well.
The client generator for Java - Spring - Webclient is not adding any "authorizations" event though they are defined. Due to this we cannot call apiClient.setBearerTocken(...)
As workaround we have to use apiClient.addDefaultHeader("Authorization", ....)
Bug Report Checklist
Description
Having generated a Python client from an OpenAPI spec including the following securityscheme:
It is not possible to use the access_token configuration parameter in the resulting client. Passing it to openapi_client.Configuration on instantiation, or adding it to the instantiated object, does not result in the Authorization header being passed in requests.
openapi-generator version
7.3.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Debug output:
Related issues/PRs
Seems related:
https://github.com/OpenAPITools/openapi-generator/issues/8865
But stated fix of setting saccess_token after instantiation of the configuration class doesn't appear to work. And the issue says it was fixed in v6. Indeed, configuration.py in the generated code does seem to include the requisite fixes:
...
Suggest a fix
I can't seem to trace down the code which is ignoring the auth_settings. There appears to be no other code that references auth['bearerAuth'].