tboneus
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2010
07:30 PM
Possible pointers for authorization of local device
Probably way off base here but I am trying to communicate with a WDTV Live so that the actions on the Roku can control the other device. I have the code working on the WDTV from a web browser so I just need to send the same instruction from the roku
The code I use is:
http://192.168.2.2/tmp/rokuRemote.php?button=&button=[then what ever action I have defined in the php script on the wdtv]
For example sending : http://192.168.2.2/tmp/rokuRemote.php?button=&button=r emulates a right click on the remote control.
The problem I have is authorizing the communication. Using http://192.168.2.2 on a web browser produces a request for a user name and password (in this case they are both wdlxtv). I have tried to send this from a Script on the Roku using
Function AuthorizeCommsForWdtvControl(url As String)
http = CreateObject("roUrlTransfer")
http.SetUrl(url)
ba = CreateObject("roByteArray")
ba.FromAsciiString("wdlxtv:wdlxtv")
http.AddHeader("Authorization", "Basic " + ba.ToBase64String())
End Function
but I get nothing back from the Print http.GetToString() so clearly I am looking at this problem incorrectly as I expected some form of a request then to send the authorization details (I think this is using basic authorization). Another thread viewtopic.php?f=34&t=34721 mentioned a similar issue but that was using SSL and a https url which I do not believe is the case in this circumstance.
Is there a way to accomplish this in a script?
The code I use is:
http://192.168.2.2/tmp/rokuRemote.php?button=&button=[then what ever action I have defined in the php script on the wdtv]
For example sending : http://192.168.2.2/tmp/rokuRemote.php?button=&button=r emulates a right click on the remote control.
The problem I have is authorizing the communication. Using http://192.168.2.2 on a web browser produces a request for a user name and password (in this case they are both wdlxtv). I have tried to send this from a Script on the Roku using
Function AuthorizeCommsForWdtvControl(url As String)
http = CreateObject("roUrlTransfer")
http.SetUrl(url)
ba = CreateObject("roByteArray")
ba.FromAsciiString("wdlxtv:wdlxtv")
http.AddHeader("Authorization", "Basic " + ba.ToBase64String())
End Function
but I get nothing back from the Print http.GetToString() so clearly I am looking at this problem incorrectly as I expected some form of a request then to send the authorization details (I think this is using basic authorization). Another thread viewtopic.php?f=34&t=34721 mentioned a similar issue but that was using SSL and a https url which I do not believe is the case in this circumstance.
Is there a way to accomplish this in a script?
5 REPLIES 5
jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2010
10:52 AM
Re: Possible pointers for authorization of local device
isn't the standard way to send username and password via url like:
http://username:password@192.168.2.2
so you could go:
http://username:password@192.168.2.2
so you could go:
http.SetURL("http://username:password@192.168.2.2/tmp/rokuRemote.php?button=&button=r")
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2010
01:56 PM
Re: Possible pointers for authorization of local device
You need to figure out what kind of authorization WDTV is using... You've described a method for Basic authorization, but it may be something different. I'd take a wireshark trace of your browser interacting with WDTV and then emulate the same traffic using the Roku as the client.
If you are using SSL, try to turn that requirement off before taking your wireshark trace so that you can analyze the requests...
--Kevin
If you are using SSL, try to turn that requirement off before taking your wireshark trace so that you can analyze the requests...
--Kevin
tboneus
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2010
06:48 PM
Re: Possible pointers for authorization of local device
Thank you for your responses. I used Wireshark and indeed the method being employed is not basic authentication but instead Digest access authentication. I will take another look during the week when I have more time to identify what needs to be sent.
YungBlood
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2010
07:40 PM
Re: Possible pointers for authorization of local device
"ComponentReference.pdf" wrote:
Boolean SetUserAndPassword(String user, String password)
* Enables HTTP authentication using the specified user name and password. Note that HTTP basic authentication is deliberately disabled due to it being inherently insecure. HTTP digest authentication is supported.
Digest auth is built in.
YungBlood
Bringing more fun to Roku!
Bringing more fun to Roku!
tboneus
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2010
07:40 PM
Re: Possible pointers for authorization of local device
Thanks guys, got it working. As YungBlood pointed out, digest authorization is built in so just needed to pass the username and password.
In case anyone might find it useful in the future the working code was:
conn = CreateObject("roAssociativeArray")
conn.UrlPrefix = "http://192.168.2.2/tmp/rokuRemote.php?button=&button="
conn.UrlCategoryFeed = conn.UrlPrefix + dir
http = CreateObject("roUrlTransfer")
http.SetUrl(conn.UrlCategoryFeed)
http.SetUserAndPassword("wdlxtv","wdlxtv")
In case anyone might find it useful in the future the working code was:
conn = CreateObject("roAssociativeArray")
conn.UrlPrefix = "http://192.168.2.2/tmp/rokuRemote.php?button=&button="
conn.UrlCategoryFeed = conn.UrlPrefix + dir
http = CreateObject("roUrlTransfer")
http.SetUrl(conn.UrlCategoryFeed)
http.SetUserAndPassword("wdlxtv","wdlxtv")