-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Issue refreshing Wix OAuth tokens - cannot send payload as JSON using refresh_token_request
compliance hook
#544
Comments
I went ahead and opened a PR with my above suggestion just to prove it out as a possibility, but I'm happy to take this any direction needed based on feedback. |
@skray I see I'm not the only one that ran into something like this! TL;DR: I was misled by the For the API I'm testing against, they have a sandbox instance, and allow you to get an auth token there to test against the APIs. Looking at that request in the browser, it took the list of scopes requested and concatenated them with '+'s. so, requesting two different scopes, {
"grant_type": "client_credentials",
"scope": "scopeType_A/scopeBranch_A.scope_A+scopeType_B/scopeBranch_B.scope_B"
} And the header includes However, when sending it via the
and the API I was working against was returning a 401 that the scope was invalid. While digging into it, I thought it was simply that the While digging into this, I found that the code path for parameters ends up in Most of that is not terribly relevant to this exact issue, but I wanted to put this somewhere that it might come up in Google searches, and you had a detailed-enough issue that it helped me track this down. |
Thanks @zach-flaglerhealth. To clarify for this issue with Wix, they are very explicitly rejecting
|
The crux of my question below is: Am I correct that there is currently no way to use the
refresh_token_request
to send a JSON payload to the token request endpoint?To explain the issue I am having, Wix's OAuth flow requires access token requests and refreshes to be made using (non-standard) JSON request bodies, instead of the standard
x-www-urlformencoded
body. Documentation for reference:I am able to get the initial access token using the
access_token_request
compliance hook, using a hook very similar to the one described in the PR that introduced the it:However, I am not able to figure out a way to use the
refresh_token_request
compliance hook in a similar way to send a JSON payload. The refresh logic is much more tightly coupled to sending the request payload asx-www-form-urlencoded
, sending only explicit kwargs into theself.post
method, including an expectation that thebody
returned from therefresh_token_request
hook is a urlencoded string. Here is the code in question:So:
x-www-form-urlencoded
body?refresh_token
method andrefresh_token_request
hook to allow this in a non-breaking way. Would something like this be a good start, allowing non-x-www-form-urlencoded
strings to be returned from therefresh_token_request
hook?The text was updated successfully, but these errors were encountered: