Skip to content

Conversation

lspgn
Copy link

@lspgn lspgn commented Jun 23, 2023

Hello,
Thank you for this library.
In some cases documented by HTTPX, when using directly the send method, the bearer token is not passed.
This change adds a method with a similar signature to request and stream with an auth parameter (those two can likely be removed too).

The only thing I have not fully tested is self.ensure_active_token(self.token) as it's in a non async function.

Thank you

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

  • You consent that the copyright of your pull request source code belongs to Authlib's author.

if not self.token:
raise MissingTokenError()

self.ensure_active_token(self.token)
Copy link
Author

@lspgn lspgn Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing with the following fixes the issue but not sure about the solution

            loop = asyncio.get_running_loop()
            asyncio.ensure_future(self.ensure_active_token(self.token), loop=loop)

@lepture
Copy link
Member

lepture commented Jul 20, 2023

@lspgn thanks for your work. Maybe you need to add a test case for send method.

@azmeuk azmeuk added the role:client Concerns a client implementation label Feb 20, 2025
@azmeuk azmeuk added the integration:httpx caused by httpx label Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:httpx caused by httpx role:client Concerns a client implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants