beberlei / TentPHP

A Tent.io client written in PHP
16 stars 3 forks source link

getting "Invalid MAC Signature" error from tent.is #8

Open Tschaul opened 11 years ago

Tschaul commented 11 years ago

Hi, I'm currently playing around with tent and php. Final goal would be a tent plugin for http://owncloud.org/ . I came across this project with helped me a lot so far. Thank you!

I try to utilize the HmacHelper.php of this project. but somehow it doesn't work for me. I checked that the code passes the signature example here https://github.com/mozilla-services/macauthlib/tree/master/macauthlib (if the algo is set to sha1).

Still i get "Invalid MAC Signature" from tent.is

heres an example:

The mac_key i got is:

76478a8ee34d962aaa6946f3bdc43b1f

and id:

s:j-o0d7dLpr_Wh_FID_UXAw

the normalized string is

1357048293 50e2e9e527aac8.55223806 DELETE /tent/followers/LDDOUnHL5VimywfGJgAEHw tschaul.tent.is 443

for the following request:

DELETE /tent/followers/LDDOUnHL5VimywfGJgAEHw HTTP/1.1 User-Agent: PECL::HTTP/1.7.4 (PHP/5.4.4-10) Host: tschaul.tent.is Authorization: MAC id="s:j-o0d7dLpr_Wh_FID_UXAw", ts="1357048293", nonce="50e2e9e527aac8.55223806", mac="cyvjRl71YQbn7hEaSbA4FnsmDOyGvgpC3Uw4bkuWeRw=" Accept: application/vnd.tent.v0+json

I get the response:

HTTP/1.1 403 Forbidden Server: nginx Date: Tue, 01 Jan 2013 13:51:35 GMT Content-Type: application/vnd.tent.v0+json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Status: 403 Forbidden Cache-Control: Request-ID: ba08933d-c986-496f-9968-311554f5427c Strict-Transport-Security: max-age=31536000; includeSubDomains

21 {"error":"Invalid MAC Signature"} 0

Can you see any flaws?