Hide the proven code javascript [duplicate]

0

I access an external google link and use a private key, for example:

 $.ajax({
            type: "GET",
            url: "https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=brksedu&key=(MINHA KEY AQUI)",
            success: function(e)

My question is: how to hide this key so that anyone who looks at the source code will not see it? Put it in a variable?

Thank you !!!

    
asked by anonymous 26.09.2016 / 14:36

1 answer

0

Impossible to hide information on the client side. Understand that whatever the browser can see, the user can also

My suggestion is to put the key in some server-side code (php, nodejs, python or whatever you are most comfortable with) and make requests on that server (by ajax or not)

Remember, pretend that the user is your worst enemy in security matters, leave as few confidential information as possible in his hand (if possible, none at all)

    
26.09.2016 / 14:55