trying to authenticate 2013-09-06T12:12:54+00:00

HOME Forums Gateways Raspberry Pi trying to authenticate

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • Anonymous
    Post count: 19
    #40385 |

    Hi guys,
    I recently got my raspberry pi and zigbee dongle (USB-CID). I was thinking of writing a small application for it and was trying out the http/xml API interface of the dongle. The first thing I tried was to authenticate. But unfortunately, this is already where I got stuck. No matter what I do, the thing always replies with:
    {“object”:””, “method”:””,”session”:”dd7fed82-cb35-4ff2-b8ac-b3c2bf4336b6″,”error”:”Not Authenticated”}
    I included the xml package as described in the documentation in the content of the http request. What am I doing wrong?

    Anonymous
    Post count: 259

    Hi,

    Are you sending the hash of the password in the Sys_Authenticate packet?

    Anonymous
    Post count: 19

    yep, I am.
    Also, if the hash is incorrect, shouldn’t I get an xml result back instead of a json stream?

    Anonymous
    Post count: 259

    Here is the Packet you should send. Notice the password “Smartenit” has been hashed (SHA1)

    ZBP_System
    Sys_Authenticate

    09cbef6f2f30e9bf9a202c53142295478786d5f3

    25784

    Response:

    ZBP_System
    Sys_Authenticate

    2

    25784
    5e9f7400-2bc3-4318-b869-ac8166874b1d

    Anonymous
    Post count: 19

    I just tried it again with fiddler, just copied your xml element and used that as request body. Still getting a json element back that says:
    {“object”:””, “method”:””,”session”:”27af8723-64a2-4945-8ab6-1ee7c19d4879″,”error”:”Not Authenticated”}�

    Anonymous
    Post count: 259

    Oh i forgot to mention that every xml packet must end with a null byte at the end. Try that and let me know.

    Anonymous
    Post count: 19

    Ok. That might explain things. I’ll have to put something together for that first. Thanks.
    I suppose this means everything you send to the api has to be ended with a null byte?

    Anonymous
    Post count: 259

    Yes the Gateway discards packets that don’t end with null bytes.

    Anonymous
    Post count: 19

    I added a null terminator to the string (added a 0 char at the end, in C++). Still getting the same json response: Not authenticated.

    Anonymous
    Post count: 259

    Hi,

    Are you sending the XML after creating a TCP socket connection to port 50333 ? I think you are using HTTP GET to get that JSON response.

    Anonymous
    Post count: 19

    Hi,
    I’m indeed using a HTTP GET request with the xml as content. In the case of the self written app, I indeed first create a TCP connection on port 50333. This works very well on other ports (to get a resonse from other services). I am also using fiddler as a debug tool so I can send http requests to the device without first having to code. For that, I just go to the composer tab, use the address http://[ip address of raspberry]:50333 and put the xml in the ‘request body’

    Anonymous
    Post count: 19

    Also, on top of each page in the class reference, there is a reference to a C header file. Where can I find those headers? (did a search on my raspberry but can’t seem to find them). Perhaps that’s an easier approach than the whole HTTP communication thing, which doesn’t seem to work…

    Anonymous
    Post count: 19

    I’v been doing some tests with the harmony gateway app. This does appear to be able to connect. I put a packet sniffer in between so I could see what exactly is being sent. So first off, you are right about the 0 char terminator, which I can’t simulate in fiddler.
    Second, I noticed that you are sending 224 data bytes, so that packet is using unix line terminators and puts a couple of spaces in front of the xml elements. I am currently sending 204 bytes as I removed all the spaces and newlines from the xml string. Other than that, I don’t immediately see much of a difference between the requests. Do you know of something else I can perhaps try?

    Anonymous
    Post count: 259

    You have to connect to the TCP Socket, http get is not supported, the gateway will always send that json response if you use http get.

    Anonymous
    Post count: 19

    ok, so I have to program against the raw sockets instead of through http. Let me try that.
    Also, I noticed that sometimes the harmony web application also fails to connect…

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.