auth0-python
auth0-python copied to clipboard
API management call and headers like X-Correlation-ID
Checklist
- [X] I have looked into the Readme and Examples, and have not found a suitable solution or answer.
- [X] I have looked into the API documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Describe the problem you'd like to have solved
Hi all,
I need to specify X-Correlation-ID header in every management call, however, despite the fact that the low-level RestClient api allow to specify any request-header, the high-level ones don't.
As an example in users lib the method to get a user is:
def get(
self, id: str, fields: List[str] | None = None, include_fields: bool = True
) -> dict[str, Any]:
"""Get a user.
Args:
id (str): The user_id of the user to retrieve.
fields (list of str, optional): A list of fields to include or
exclude from the result (depending on include_fields). Leave empty to
retrieve all fields.
include_fields (bool, optional): True if the fields specified are
to be included in the result, False otherwise. Defaults to True.
See: https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
"""
params = {
"fields": fields and ",".join(fields) or None,
"include_fields": str(include_fields).lower(),
}
return self.client.get(self._url(id), params=params)
That doesn't allow to specify any request parameter.
Describe the ideal solution
What about change all the method signatures specifying an optional last parameter with the request_headers like this:
def get(
self, id: str, fields: List[str] | None = None, include_fields: bool = True, request_headers: dict = None
) -> dict[str, Any]:
...
return self.client.get(self._url(id), params=params, headers=request_headers)
Alternatives and current workarounds
No response
Additional context
No response
Thanks for raising this @a-marcellini - i'll review your request and get back to you
Hi @a-marcellini - we can do this, but I can't give you a timeline. You're welcome to offer a PR in the meantime, or wait for us to schedule it in.
Came here with same request :)
Following up on this.
@a-marcellini Do you still want to contribute a PR for this? I could take a look and discuss with @adamjmcgrath on how to take it forward.
Thanks!
Hi @a-marcellini ,
Following up on the discussion in this issue regarding adding the ability to specify custom headers for Management API calls.
We appreciate the feature request and the initial discussion around its implementation. As mentioned previously, this is a valid enhancement, and we are open to contributions for it.
However, there hasn't been significant activity or a Pull Request opened for this feature since the offer to review contributions back in October 2023 and the follow-up in January 2025.
While we understand the potential usefulness of this feature, based on the current level of community engagement on this issue, it is not a high priority on our immediate development roadmap.
To help manage our issue backlog, we will be closing this issue due to inactivity.
This doesn't mean we're against the idea in the future. If community demand for this feature increases significantly, or if someone is willing to contribute a Pull Request to implement it, please feel free to comment, and we can certainly consider reopening the issue.