I try to authenticate against a magento server ( REST API using OAuth. I am using the java scribe api. But I got always a http error 401 'signature_invalid'. This is the complete debug information from scribe:

obtaining request token from http://myhost.local:11180/magento/index.php/oauth/initiate
setting oauth_callback to oob
generating signature...
using base64 encoder: DatatypeConverter
base string is: POST&http%3A%2F%2Fmyhost.local%3A11180%2Fmagento%2Findex.php%2Foauth%2Finitiate&oauth_callback%3Doob%26oauth_consumer_key%3D77gqhzp35ka9euqqczn5sgr5s5ayeylx%26oauth_nonce%3D2377064468%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1407597421%26oauth_version%3D1.0
signature is: fXGszEGFPnKYdLKTJLoQcrCZjps=
appended additional OAuth parameters: { oauth_callback -> oob , oauth_signature -> fXGszEGFPnKYdLKTJLoQcrCZjps= , oauth_version -> 1.0 , oauth_nonce -> 2377064468 , oauth_signature_method -> HMAC-SHA1 , oauth_consumer_key -> 77gqhzp35ka9euqqczn5sgr5s5ayeylx , oauth_timestamp -> 1407597421 }
using Http Header signature
sending request...
response status code: 401
response body: oauth_problem=signature_invalid&debug_sbs=tDohHQ22G9KAwR7Inn0CVSxpF2c=

The REST API in general works because I can receive stockitems from the URL /magento/api/rest/products

I am also able to run the same code against my local developer magento installation (

What could be the reason for this error message? On my test server I need to work with the port number 11180. Could this be the problem?


1 Answer 1


It seems that Magento can not handle different ports than 80. See: https://stackoverflow.com/questions/14508958/magento-rest-api-oauth/14693714#14693714

But if I change the file : /magento/app/code/core/Mage/Oauth/model/Server.php


$this->_request->getScheme() . '://' . $this->_request->getHttpHost() . $this->_request->getRequestUri()


 $this->_request->getScheme() . '://' . $this->_request->getHttpHost() .':11180' . $this->_request->getRequestUri()

I was able to receive a valid request token. But unfortunately then get another error when try to access the rest api

 oauth_problem=internal_error&message=Invalid URI supplied

Maybe this is another php file which need to be changed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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