Skip to content

Fix callback authentication#2

Open
aclave1 wants to merge 2 commits into
ShippingEasy:masterfrom
Envoc:master
Open

Fix callback authentication#2
aclave1 wants to merge 2 commits into
ShippingEasy:masterfrom
Envoc:master

Conversation

@aclave1
Copy link
Copy Markdown

@aclave1 aclave1 commented Jan 29, 2018

Fixes a bug where webhook callbacks that contained no querystring parameters other than api_signature would fail. This is because the request is signed without stripping out this extra parameter. If a request contains no querystring parameters, it is signed like this:

POST&/my/url&&{"shipment":

Note the two ampersands(&). Even though there are no querystring parameters, this should still be the string that is signed.

@alextretij
Copy link
Copy Markdown

You are not right.
If you want to get orders you should skip the body.

        var param = (new[]{
            _httpMethod.ToUpper(),
            _path,
            combinedParameters,
            }).ToList();
        if (!string.IsNullOrWhiteSpace(_body))
            param.Add(_body);
        
        return String.Join("&", param
        );

@aclave1
Copy link
Copy Markdown
Author

aclave1 commented Jul 22, 2018

@alextretij This code is not for getting the orders, it's for verifying shipping easy's callback signatures. If this is no longer correct, then shipping easy has changed their signature generation code. This implementation came from conversations with shipping easy's support.

@alextretij
Copy link
Copy Markdown

No, this ShippingEasy SDK uses this Signature class for all requests (get orders, send order and get answer from shippingeasy site)

@aclave1
Copy link
Copy Markdown
Author

aclave1 commented Jul 23, 2018

Look... I'm not going to argue with you dude. You are welcome to use the Nuget package without this PR in it. If the webhook authentication callbacks work without this PR, then shipping easy has changed their webhook code to work around this bug, and we can close the PR. I will say again that this code comes from conversations with shipping easy's developers. They asked me to submit this PR, so I did.

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

Successfully merging this pull request may close these issues.

2 participants