crossbar icon indicating copy to clipboard operation
crossbar copied to clipboard

Call php curl to Bridge REST caller with signature error

Open samspade0069 opened this issue 5 years ago • 2 comments

I can't execute a php curl call with signature. Always return REST bridge signature secret not valid.

I follow the instructions in the documentation but they never match. I do not know what's happening.

I check the value of php hash sha256 in online page and is correct and also the base64 transform

samspade0069 avatar Feb 13 '20 18:02 samspade0069

Kindly provide your crossbar config as well as some sample code that we could use to reproduce the issue.

om26er avatar Feb 13 '20 18:02 om26er

Config rest call bridge signed

"type": "web", "endpoint": { "type": "tcp", "port": 9091 }, "paths":{ "callsigned": { "type": "caller", "realm": "OPENVEND", "role": "clean", "options": { "key": "foobar", "secret": "secret", "post_body_limit": 0, "timestamp_delta_limit": 0, "debug": true } } }

Data to crossbar params url timestamp=2020-02-13T18%3A42%3A16.000Z&key=foobar&seq=20&nonce=394559421&signature=1KRW14PK6n9q4tzG75o9f0IZ269Pi9cS2klzEw9a2VQ

message by create signature foobar2020-02-13T18:42:16.000Z20394559421{"procedure":"cleanapp.pwa3.840D8EA3CDC1.do","args":[3,"840D8EA3CDC1","5837","23","207",1]}

functions used in php $hmac = hash_hmac('sha256', $message, $secret, true); $signature= str_replace(['+','/','='], ['-','_',''], base64_encode($hmac));

samspade0069 avatar Feb 13 '20 19:02 samspade0069