+ Start a Discussion
suresh dupadasuresh dupada 

403 Forbidden Error

Hi All
       I am trying to retrieve customers and orders from magento, through API Access, But I am always getting response like "403 Forbidden" as a response status, I am using consumerkey and consumerSecret key and accessToken And Token secret keys to retrieve the data, But when i try to retrive customers from restClinent or POST Man I am getting the status as 200, then it was fine (Using the same keys)
But what was the reason for this error,
I am testing in my sandbox, using OAuthPlayground by installing managed package, one month ago it was worked fine, like it is retrieve everyting what ever i request, but now it is showing 403 Forbidden error,

Please let me know what was the reason for that
Best Answer chosen by Shashank (Salesforce Developers) 
suresh dupadasuresh dupada
Finally I came to know This error is throwing all because of nginx rejects cURL requests,

Actually While making request we need user-agent header. curl -H "User-Agent: Firefox/29.0" -H "Accept: */*"

    request.setHeader('User-Agent','Firefox/29.0');
    request.setHeader('Accept','*/*');

By Including Two Headers I got Success Response.....
      Below link tells what is cURL


               http://curl.haxx.se/docs/manpage.html
      And I found this solution in below URL
               http://stackoverflow.com/questions/24000223/why-nginx-rejects-curl-requests
        

All Answers

TuringTuring
what is the Salesforce host name of your sandbox?
suresh dupadasuresh dupada
Hi Turing Thanks for Replay
          I am unable to express my hostname Here, Is there something related to hostname,

xxxxxxxxxx means client name and remaining is same
https://xxxxxxxxxx--dev.cs18.my.salesforce.com
TuringTuring
Hi Sureah,

Looks like your salesforce host server name is CS18, the reason why i ask you i had the same issue and my server name is CS8.
ShashankShashank (Salesforce Developers) 
Hi Suresh,

This should be due to the recent SHA-256 change. You can find more information about it and how to prepare for it here: https://help.salesforce.com/apex/HTViewSolution?urlname=HTTPS-Security-Certificate-Switch-from-SHA-1-to-SHA-256-hash-algorithms&language=en_US

Please let me know if you need anything else.

Thanks,
Shashank Srivatsavaya
Salesforce.com
suresh dupadasuresh dupada
Finally I came to know This error is throwing all because of nginx rejects cURL requests,

Actually While making request we need user-agent header. curl -H "User-Agent: Firefox/29.0" -H "Accept: */*"

    request.setHeader('User-Agent','Firefox/29.0');
    request.setHeader('Accept','*/*');

By Including Two Headers I got Success Response.....
      Below link tells what is cURL


               http://curl.haxx.se/docs/manpage.html
      And I found this solution in below URL
               http://stackoverflow.com/questions/24000223/why-nginx-rejects-curl-requests
        
This was selected as the best answer