Skip to content
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

Revoke throws an error when trying to process the response #170

Open
Matthew-John-Emerson opened this issue Apr 2, 2024 · 9 comments
Open

Comments

@Matthew-John-Emerson
Copy link

When I call revoke, I end up getting an error because it is trying to destructure the response JSON when the json is null. This happens even though the request to Intuit succeeds and the token is revoked. Also, it looks like the tests for revoke are also failing locally.

@bogeorget4
Copy link

I'm seeing this as well. The error I get is "TypeError: Cannot destructure property 'request' of '(intermediate value)(intermediate value)(intermediate value)' as it is null."

It says it's occurring here https://github.com/intuit/oauth-jsclient/blob/master/src/OAuthClient.js#L319

@rajeshgupta723
Copy link
Collaborator

Thanks @Matthew-John-Emerson and @bogeorget4 , could you please help with the steps to reproduce this error.

@crisebrough
Copy link

I run into this as well. I am able to see it when I connect to QBO, and then disconnect through the use of OAuthClient.revoke(); which responds with status 200 but there is no body on the JSON response. Thus, the disconnect is successful but it throws an error.

@stepanFederlian
Copy link

Hi, @rajeshgupta723
I have the same problem, I use intuit-oauth: 4.1.2.

@vektorblake
Copy link

I too am encountering this issue, on a DELETE request. 4.1.2

@rajeshgupta723
Copy link
Collaborator

Hi, thank you all, will look into this. In the meantime, feel free to raise a PR for the fix.

@amadeogallardo
Copy link

This is what is logged when using the revoke function:

image

@rajeshgupta723
Copy link
Collaborator

Hi @amadeogallardo @vektorblake @stepanFederlian @Matthew-John-Emerson @crisebrough @bogeorget4 -- could you all please get the latest from the branch release-4.1.3 and test this out. Please confirm if the fix works for you. Thanks

@m4xleb
Copy link

m4xleb commented May 21, 2024

Hi @rajeshgupta723 , I did try the release-4.1.3 and still got an issue.

The res returns an empty body and a null json. It seems like the validation of the json is to make sure we get a valid response from the server.

I have attached a screen shot.
image

I have changed line 319 from

const authResponse = res.json ? res : null;

to

const authResponse = res.hasOwnProperty('json') ? res : null;

and the error ran away.

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

No branches or pull requests

8 participants