intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
123 stars 159 forks source link

createToken not returning AuthResponse object (ie. `getJson()` is not a function) #167

Closed johne closed 6 months ago

johne commented 6 months ago

in createToken the response from getTokenRequest is an AuthResponse but this line:

      const { response, ...authResponse } = res.json ? res : null;

turns it into an object which looses all the prototype functions.

according to the documentation here: https://github.com/intuit/oauth-jsclient?tab=readme-ov-file#step-2 you should be able to call getJson on the result of createToken but since it is plain object, getJson is not a function.

a workaround is to just use .json to get the json directly.

rajeshgupta723 commented 6 months ago

Hi @johne, the workaround and updated documentation have been pushed to this branch: https://github.com/intuit/oauth-jsclient/tree/release-4.1.2

Please feel free to validate and/or raise PR if you need to. Thanks

rajeshgupta723 commented 6 months ago

Hi @johne, Release 4.1.2 has been pushed out, please checkout at https://github.com/intuit/oauth-jsclient/releases

closing this issue. please feel free to reopen this if you still see any issues. Thanks

junder31 commented 6 months ago

The 4.1.2 artifact on NPM does not appear to contain these latest changes. I'm still not able to successfully make requests with response types other than JSON.