Skip to content

fix: allow auth token getter override over client header #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/toolbox-core/src/toolbox_core/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,14 @@ async def __call__(self, *args: Any, **kwargs: Any) -> str:

# create headers for auth services
headers = {}
for client_header_name, client_header_val in self.__client_headers.items():
headers[client_header_name] = await resolve_value(client_header_val)

# In case of conflict, override the client header by the auth token getter
for auth_service, token_getter in self.__auth_service_token_getters.items():
headers[self.__get_auth_header(auth_service)] = await resolve_value(
token_getter
)
for client_header_name, client_header_val in self.__client_headers.items():
headers[client_header_name] = await resolve_value(client_header_val)

async with self.__session.post(
self.__url,
Expand Down