Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ooshwa
Visitor

Re: Need help with Roku2 HLS : error 403

i determined the issue and a workaround:

http://forums.roku.com/viewtopic.php?f=34&t=66537
0 Kudos
sheetaloza
Visitor

Re: Need help with Roku2 HLS : error 403

I had similar issue, where I wanted to access protected stream urls by making two api calls. First was the login, which will generate the cookie and using that cookies I need to make play api call to get the stream. I struggled for couple of hours and then found this solution (with the help of my colleague).


function requestData(port as Object, url as String, cookie="" as Dynamic) as Object
request = createObject("roUrlTransfer")
request.setPort(port)
request.setUrl(url)

if cookie <> "" then
request.addHeader("Cookie", cookie)
end if

request.setCertificatesFile("common:/certs/ca-bundle.crt")
request.initClientCertificates()
request.enableCookies()
request.enableFreshConnection(true)
request.retainBodyOnError(true)

request.asyncGetToString()

return request

End Function


Order of the AddHeader and enableCookies, matters a lot. I had the order other way round and it always slapped me with 403 (forbidden) error cause cookies were not set to the next http GET request.
Dont forget to EnableCookies on your video player as well as they both (roUrlTransfer and roVideoPlayer) shares the same inteface ifHttpAgent.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.