Forum Discussion

paul_striker's avatar
paul_striker
Reel Rookie
5 years ago

Roku video player with AWS CloudFront Signed cookies

I'm using AWS CloudFront as CDN to host my videos (HLS i.e., .m3u8) and using signed cookies to authenticate. Three set of cookies need to be set to the request header, CloudFront-Policy, CloudFront-Signature and CloudFront-Key-Pair-Id in order to retrive the .m3u8 file from CloudFront. I tried the following:

 

httpAgent = CreateObject("roHttpAgent")
cookies = [
{ Name: "CloudFront-Policy", Value: "val", Path: "/", Domain: "domain.com" },
{ Name: "CloudFront-Signature", Value: "val", Path: "/", Domain: "domain.com"},
{ Name: "CloudFront-Key-Pair-Id", Value: "val", Path: "/", Domain: "domain.com"}
]
httpAgent.EnableCookies()
httpAgent.AddCookies(cookies)

m.videoPlayer.setHttpAgent(httpAgent)

and 

 

httpAgent.AddHeader("Cookie", "CloudFront-Policy=" + val1 + "; " + "CloudFront-Signature=" + val2 + "; " + "CloudFront-Key-Pair-Id=" + val3)

But none helped! ๐Ÿ˜ž

Even, I tried using the Roku Stream/RAF Tester but unfortunately I have TelstraTV device which didn't allow me to link with the Roku developer account.

 

 

3 Replies

  • roAmanda's avatar
    roAmanda
    Roku Employee

    We recommend purchasing a retail Roku device for channel development testing. You can find them on eBay.

    You need to be initiating secure sockets on this object. We don't see that part of your code.

    • paul_striker's avatar
      paul_striker
      Reel Rookie

      Thank you for the reply.

      But I coundn't understand why I have to initiate secure sockets? Do you mean secure https?

      httpAgent.SetCertificatesFile("common:/certs/ca-bundle.crt")
      httpAgent.InitClientCertificates()
      • RokuDavid's avatar
        RokuDavid
        Roku Employee

        Yes, you are correct - https. Let us know if that doesn't work.