Skip to content

Allow refresh_token_request compliance hooks to actually use JSON - #575

Open
gilou wants to merge 1 commit into
requests:masterfrom
gilou:make_refresh_compliance_hook_usable_for_json
Open

gilou wants to merge 1 commit into
requests:masterfrom
gilou:make_refresh_compliance_hook_usable_for_json

Conversation

@gilou

@gilou gilou commented Sep 20, 2026

Copy link
Copy Markdown

As mentioned on #544 , but also in other places, if we need to use the refresh_token logic on endpoints that expect JSON instead of x-www-form-urlencoded, well, we can't, because we are given only body in the hooks, which is passed as keyword argument data for Request().

This PR tries to address it by checking if the Content-Type header was set to application/json, and if so, submits the data using the json parameter.

My opinion would be to make the refresh_token_request hooks behave the same as access_token_request, and allow to manipulate kwargs for the request, but that would break existing hooks that are used to manipulate the body/data directly.

@gilou gilou changed the title Allow compliance hooks to actually use Content-Type: application/json Allow refresh_token_request compliance hooks to actually use JSON Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant