Fix oauth_callback_confirmed comparison when server returns extra whitespace - #56
Conversation
|
As far as I can tell, Netsuite isn't really allowed to have a trailing newline in their |
|
@dghubble For other parts of the flow (e.g. getting the access secret) I'm able to work around the same issue by stripping the newlines on our side since we get the values back from the library, but since the case for Would it be more reasonable to strip whitespace just when checking The only non-breaking alternative I can think of would be to allow adding a custom oauthCallbackConfirmed comparison function to the config, which seems like overkill to me and for most users an unneeded bloat of the config. Anything sound good here? |
|
@dghubble Would be awesome to get this one merged! Thx a lot |
I'm working against the Netsuite API and found that there is an added newline in the response body during the
RequestTokenflow, and since their response setsoauth_callback_confirmedas the last body parameter, this causes the comparisonvalues.Get(oauthCallbackConfirmedParam) != "true"to fail while comparing against the parsed valuetrue\n.Since the tests don't use the same order of parameters in the mocked response I've added a newline to the response and trimmed that during body parsing to ensure trailing whitespace always gets removed. In this case the mock change will cause a failure without the
TrimSpacewhile checking theexpectedSecret.