Closed Zaheer211 closed 4 years ago
I believe the issue is GET's without a query string are getting two ??.
In Request.js, change line 100 from
if (method === METHOD.GET) {
to
if (method === METHOD.GET && Object.keys(paramGet).length > 0) {
Could also merge the separator and apiUrl code, so...
__sign() {
let specialHeaderParams = this.header;
let privateKey = this.config.secret;
let method = this.method;
let paramPost = this.data || {};
let paramGet = this.query || {};
let separator;
let params = Object.assign({}, specialHeaderParams, paramPost);
params = encrypt.ksort(params);
var apiUrl = this.config.baseUrl + this.url;
if (this.method === METHOD.GET && Object.keys(paramGet).length > 0) {
apiUrl += ('?' + querystring.stringify(paramGet));
separator = '&';
} else {
separator = '?';
}
let signatureString = `${method} ${apiUrl}${separator}${encrypt.serialize(params)}`;
console.log(apiUrl);
console.log(signatureString);
let hash = encrypt.hmac_sha(privateKey, signatureString);
this.header['X-MW-SIGNATURE'] = hash;
}
I'm getting this same issue still..
This is bug and brianchance is absolutely correct.
This is bug and brianchance is absolutely correct.
I fixed the code, make sure to update to 1.0.0, also do the following (I saw this posted on another github repository about the API):
Check that you have set "DISABLE SIGNATURE CHECK" to "YES" in Settings->API - direct URL: https://YOURMAILWIZZ.SERVER/backend/settings/api
Hi,
We're using node-mailwizz and it responds with error Invalid API request signature. Please refer to documentation. when creating a list. It works well when adding a subscriber to a list or getting lists or subscribers in a list and so on.
Any help would be hugely appreciated! Thanks