Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

secure the code in google chrome extension

I want to write a google chrome extension, that should make a request to my website to send and get some data, so, actually I should do an ajax request like it is written here https://developer.chrome.com/extensions/xhr.html

var xhr = new XMLHttpRequest();
xhr.open("GET", "http://api.example.com/data.json", true);

I wanted ask if there is a way to somehow secure the code or prevent others from using my api, because actually the other users can see the source code of the extension when they install it and so use my api without me being aware of it.

EDIT:

If I need to make some sort of authentication, than how can I authenticate the user before making the ajax call ? for authentication I will need to send a request to my server , but for that I should send , e.g. username and password, that should be saved somewhere in the extension's files, which, in fact, can be seen by the users, when they install the extension.

Thanks

like image 332
dav Avatar asked May 26 '13 19:05

dav


1 Answers

I think you are doing it wrong. You should never trust what's going on on internet users PC's. Never!

Move the line of trust one step inward, make your API public and then design the security where you have perfect control - server side.

like image 158
mogul Avatar answered Oct 18 '22 15:10

mogul