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

.getJSON method invoked on xml throws sdk error, masking the original problem #118

Open
railz-guli opened this issue Jun 14, 2021 · 3 comments · May be fixed by #120
Open

.getJSON method invoked on xml throws sdk error, masking the original problem #118

railz-guli opened this issue Jun 14, 2021 · 3 comments · May be fixed by #120

Comments

@railz-guli
Copy link

We're using nodeJs sdk, version 3.0.2 and for certain requests we make with makeApiCall the error we're getting is Error: AuthResponse is not JSON at AuthResponse.getJson (/var/app/current/node_modules/intuit-oauth/src/response/AuthResponse.js:106:29) at OAuthClient.createError

After investigating the error it came to our attention that the sdk is getting back an xml instead of JSON. Moreover, the way sdk handles/throws/logs the error masks the original error we're getting in the xml (we want to see the issues in production). For the short term, if you could add logs before calling .getJSON on the response it would be very helpful.

Thank you!

@aiden5221
Copy link

I'm having this same issue, whenever I attempt to make a request with makeApiCall I'm receiving the error
Error: AuthResponse is not JSON at AuthResponse.getJson (~\node_modules\intuit-oauth\src\response\AuthResponse.js:106:29)

I'm receiving this error after using the code example from app.js. I believe my authorization flow is correct so I don't know where to go from here.

@akoskm
Copy link

akoskm commented Jul 20, 2021

I can also confirm this. We tried setting the headers in makeApiCall but it had no effect:

      await oAuthClient.makeApiCall({
        url,
        method: "GET",
        headers: {
          Accept: "application/json",
          "Content-Type": "application/json",
        },
      })

the response is still coming back as XML:

<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2021-07-19T22:39:33.743-07:00">
   <Fault type="AuthenticationFault">
      <Error code="100">
         <Message>General Authentication Error</Message>
         <Detail>AuthenticationErrorGeneral: SRV-110-Authentication Failure , statusCode: 401</Detail>
      </Error>
   </Fault>
</IntuitResponse>

@JimPatterson JimPatterson linked a pull request Oct 20, 2021 that will close this issue
@syJSdev
Copy link

syJSdev commented Feb 17, 2022

Hi @abisalehalliprasan ,
This issue requires an urgent fix. I can't get what is the API response.
Even if I set the Accept header to 'application/json', the API returns in xml format. also, this issue only occurs when the API responds with an error.

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

Successfully merging a pull request may close this issue.

5 participants