Saturday, 7 December 2019

Tips for adding authentication to video streaming route?

So i am using express, and currently I have a route that streams video to the client, but i would like to add authentication to this. Currently on the client side I use just the standard element, because of this there is no way for me to send an authorization header. I actually ran into a similar issue with image downloading, which made me create a route that creates a temporary one-use token, which expires in two seconds, and use that method instead. But the problem with video streaming, is in order to be able to fast-foward/rewind, one must set the Accept-Ranges header to bytes. (https://stackoverflow.com/questions/24976123/streaming-a-video-file-to-an-html5-video-player-with-node-js-so-that-the-video-c), this will make it so the get request for the video will be called multiple times, sometimes only once, or sometimes three or more, which makes it so that temporary token i was using for images will not work in this case. What would be the best way to secure this route? I would like to avoid using a temporary token that expires in a day or something like that, and i would also like to avoid using cookies to send the authorization header if possible.​​Here is the express route​Here is the client side JS​Here is the same request being sent multiple times​And lastly here is the HTML video element

Submitted December 08, 2019 at 06:35AM by subnub99

No comments:

Post a Comment