Reputation: 368
I just want to ask what would be the best way to hide sensitive data using anugularJS.
I am developping a VOD (Video On Demand) app in which I have to make movies' links hidden and not accessible by users.
For example, I get this JSON from backend using $http inside a moviesFactory:
{ "title": "movieTitle", "link": "www.some-provider-link.com/movie-link.mp4"}
And when I need to show the video, I put this JSON in my scope like that:
$scope.movie = moviesFactory.getMovie().then(callbackOk, callbackNonOk);
My problem is since the scope is accessible from user using chrome extensions or even angular.element(document.getElementById('anElementId')).scope()
everyone can access my scope and see the links.
So what am I doing wrong? ANd how can I hide those data?
Upvotes: 0
Views: 330
Reputation: 2947
You can't directly by this way, because javascript is executed in client side (and you have not full control of the sources you provide to the clients).
And sharing (encrypted/obscured or not) your complete files url ('www.some-provider-link.com/movie-link.mp4') it's NOT a good idea, if you are concerned of the privacy of those files.
You should consider including some sort of authentication (like tokens) and make an API in your server that gives you all the data you needs (like .mp4 files) as a stream of bytes, when a user is authenticated.
Upvotes: 1