Skip to content

Can't read response in Auth.auth_flow #802

Closed

Description

@georgek

I want to implement auto-refreshing of a token but in order to get the new token I need to be able to read the server response in the custom auth_flow method.

It seems like a trivial change to get the client to read() or aread() the response before sending it back (like it does with the request), and things actually seem to work fine, but some tests break which I don't understand so wanted to check that I'm not doing completely the wrong thing here.

Activity

  1. florimondmanca commented on Feb 3, 2020

    @florimondmanca
    Contributor

    Hi!

    I assume you’d like to access the response body because the server returns an auth token as a JSON payload, eg {"token": "123abc"}, right?

    Being able to access the request body is documented at the end of Customizing Authentication, but we don’t have such a flag for responses yet.

    Sounds like a sensible symmetric addition to me, though! Want to throw a PR together to see what it would look like? :)

  2. lovelydinosaur commented on Feb 3, 2020

    @lovelydinosaur
    Member

    Indeed, adding a requires_response_body attribute would make sense.

  3. georgek commented on Feb 3, 2020

    @georgek
    ContributorAuthor

    OK, great! I'll have a go at it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions