0

I am trying to get a REST response by hitting a remote API, I am getting response from local machine some other servers, but only from a particular ip address I am getting response X-Mashery-Error-Code ,Value : ERR_403_NOT_AUTHORIZED.

I checked with service provider they are not blocking any ip addresses. I am passing an Api key and a signature which is generated using a shared secret key using sha256 like below. org.apache.commons.codec.digest.DigestUtils.sha256Hex(apiKey + sharedSecret + System.currentTimeMillis() / 1000);

What could be the reason this is not working from a particular ip address.

Any help would be greatly appreciated.

1 Answers1

0

ERR_403_NOT_AUTHORIZED happens with Mashery when your authentication is not proper. I can mean that your key/secret is not correct, or your oAuth2 token is expired, or your SHA256/MD5 signatures are not proper.

Mashery-Error-Code ,Value : ERR_403_NOT_AUTHORIZED normally doesn't happen when an IP is blocked.

In this case, I think the issue is beacuse you use System.currentTimeMillis() / 1000.

Instead of that, can you try Math.round(new java.util.Date().getTime() / 1000)

org.apache.commons.codec.digest.DigestUtils.sha256Hex("apiKey" + "sharedSecret" + Math.round(new java.util.Date().getTime() / 1000))

If this didn't work, can you check if there is another header X-Error-Detail-Header, if yes what is it value ?

Abbin Varghese
  • 2,422
  • 5
  • 28
  • 42