-
Notifications
You must be signed in to change notification settings - Fork 176
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
Issue when + sign is present in URL (Amazon SP-API, NextToken) #126
Comments
What's converting the |
The returned From the above code, If I do a Original NextToken:
You'll see the |
If I replace the Something like this: const ss = aws4.sign(
{
host: this.ENDPOINT,
method: "GET",
path: `/orders/v0/orders?&MarketplaceIds=A1AM78C64UM0Y8&NextToken=${queries.NextToken.split('+').join('%2B')}`,
region: "us-east-1",
service: "execute-api",
headers: {
"User-Agent": "Fiscalpop/2.0 (Language=JavaScript; Platform=Ubuntu/16)",
'x-amz-access-token': tokenized.access_token
},
},
{
accessKeyId: "ASIA2PIENJRBCFHH...",
secretAccessKey: "IePqZ5lBHhrJdzQbqyZ8U5t0eRgz6SjIn...",
sessionToken: "FwoGZXIvYXdzED8aDKQUTa4ly/nPYc+PuSKqAfQd60RsmIwhrqH...",
}
); Then the returned And I'm able to receive the query response using the token. Otherwise, without replacing the + char in the parameter before passing it to We could not decode your NextToken. Possible reasons include: a transmission error, improper quoting or a truncation problem. |
hello @GbalsaC sir {'errors': [{'message': None, 'code': 'InvalidInput'}]} |
Python 3.x GbalsaC, |
Hi, I am getting Same issue that was discuuing here, Any final conclusion on te same? I am using java |
aws4 v. 1.5.1
Ubuntu 20 LTS
NodeJS 12.6.9
request 2.48.5
request-promise 4.1.46
I'm currently using aws4 for Amazon SP-API (Selling partner API).
Overall, all methods work great except for one query parameter. NextToken
NextToken (Original value) is passed as a query parameter, and has the following value:
aQVM/pLGd/WaJqJYLDm0ZAmQazDrhw3CIiPeQUe9nqoU5ywFddC8C8NI3HOI22PIxqXyQLkGMBs8VhF73Xgy+zFWYRqN5/If2Yapt4MO4XEckwaFrMP2PNhNqgDpVGhEInTAy+XKVmRZBY+oaVuyc8QON+K1yc/YJ8IamK5qOBQwadZWHCdmNwFvOUDdDJWhf2GLmUGyr9UGnxD0RJmrryegoU0IPZxXMHbcorlruypW//smqbZGEWWjslwBjY4mMBO/reDY2s/v6DywD2BmVI0KxWlk275HeLE0br61/ZeG1bEi00oPms+RCEjxtHY0Jjna3DT40pCuDpTeKOS1CbZT8ssvaHo22iqc+HOHQDMXf4cGOMyIyW3zKN+nx8rxYJu46S68kxWtOgCxg3zeweCR1k9eFxFwVqnodKShpq/Y/mfOjS3d9A==
However, this returns the final query, replacing
+
char with%20
, where the query ends looking like this:https://sellingpartnerapi-na.amazon.com/orders/v0/orders?NextToken=aQVM%2FpLGd%2FWaJqJYLDm0ZAmQazDrhw3CIiPeQUe9nqoU5ywFddC8C8NI3HOI22PIxqXyQLkGMBs8VhF73Xgy%20zFWYRqN5%2FIf2Yapt4MO4XEckwaFrMP2PNhNqgDpVGhEInTAy%20XKVmRZBY%20oaVuyc8QON%20K1yc%2FYJ8IamK5qOBQwadZWHCdmNwFvOUDdDJWhf2GLmUGyr9UGnxD0RJmrryegoU0IPZxXMHbcorlruypW%2F%2FsmqbZGEWWjslwBjY4mMBO%2FreDY2s%2Fv6DywD2BmVI0KxWlk275HeLE0br61%2FZeG1bEi00oPms%20RCEjxtHY0Jjna3DT40pCuDpTeKOS1CbZT8ssvaHo22iqc%20HOHQDMXf4cGOMyIyW3zKN%20nx8rxYJu46S68kxWtOgCxg3zeweCR1k9eFxFwVqnodKShpq%2FY%2FmfOjS3d9A%3D%3D&MarketplaceIds=A1AM78C64UM0Y8
So, char replacement can be seen in:
+XKVmRZBY+oa
becomes%20XKVmRZBY%20oa
I understand in query, + sign becomes a space, and probably %2B should be used instead, my question is, how should I add the parameter into the sign method if the original has a + char, should I replace it before passing? or should I replace it after the path is returned from
sign()
My complete code is the following:
The text was updated successfully, but these errors were encountered: