-
Notifications
You must be signed in to change notification settings - Fork 751
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
Handle errors from the oauth/token endpoint #602
Conversation
Thanks for the contribution @mdlavin! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heya Matt! Thanks for the contribution!
Does the test fail without the added application code in lib/StripeResource.js
? (Pretty sure it would).
Assuming so, this LGTM! (Will await an affirmative response, or verify myself when I have time, before merging).
Yes, the test fails without the changes in
The |
Awesome, thanks so much Matt! |
@rattrayalex-stripe thanks for merging. Are new releases regularly scheduled? |
Released! We generally try to release ~immediately after merging master; apologies for the delay. |
Before this change, failures from the OAuth API would result in
Invalid JSON received from the Stripe API
errors.The cause was not a parse error, but an error thrown at https://github.com/stripe/stripe-node/compare/master...mdlavin:handle-oauth-errors?expand=1#diff-404ddfdf655bbca4b088b8c7242d0a3aL155 when the
headers
value was assigned to a string value.The response body coming back from the oauth/token endpoint is:
As described in https://stripe.com/docs/connect/oauth-reference#post-token-errors
I also added a nicely typed Error for invalid_token responses, and the other OAuth failures will be reported as Generic errors instead of Invalid JSON errors