I get an error on Initialize method.

The provided consumer secret was rejected by the server at url 'http://localhost/oauth/initiate' for consumer key 'mycosumerkey'.

I get this error when the method is called.

Here is my call:

var client = new MagentoApi()
                    .AuthenticateAdmin("adminUsername", "adminPassword");



OAuth oauth_callback="http%3A%2F%2Flocalhost%3A8888",oauth_consumer_key="MY_OAUTH_CONSUMER_KEY",oauth_nonce="8dplf7w2vhrynu7t",oauth_signature="flV4JMqYx0WUrl%2BoTtPYh9v3%2BQ0%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1466712244",oauth_version="1.0"

HTTP/1.1 401 Unauthorized
Date: Thu, 23 Jun 2016 20:01:06 GMT
Server: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.5.24
X-Powered-By: PHP/5.5.24
Set-Cookie: PHPSESSID=nb4bs797b5jkcetakl0pqdhek7; path=/; domain=; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 31
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded


My version of Magento is:

Any sugestion?

1 Answer 1


It worked fine for me. The problem is the port number.

I learned you can't include the port number of a URL for an Oauth Request. The port number gets stripped, so when the keys are compared, they don't match. Changing the port to 80 (so that it doesn't have to be included in the url) solved the problem.

REF: https://stackoverflow.com/questions/14508958/magento-rest-api-oauth/14693714#14693714

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.