angularjs - Private video via REST api -
hi i'm trying implement auth protected audio/video stream in angular app via rest api. goal secure audio/video not shared other not logged users. tried single use token flow looks this:
- angular ask single use token after click play button
post: file/1/token
- angular token , paste token url
?token=...
- stream request send server
get: file/1?token=...
- server checks token , removes database
- if token right stream begin
the problem came when click on timeline stream not buffered yet browser automatically sends request of course unauthorized because token has been removed.
i want keep api stateless see kind of state forced html media.
i love hear hints or solutions on problem.
problem solved now. maybe it's not best solution covers requirements. decided use session breaks rest principles works.
now getting token before post: file/1/token
getting file provided token get: file/1?token=...
the difference in controller open new php session, save token session , remove database. able check whether token in database or in session.
so if send link other people don't have access. have access long token in php session.
Comments
Post a Comment