8
On my site I use the Facebook API, through ACCESS_TOKEN
. This 'key' of access to everything that the corresponding application can provide, that is, it is not feasible to leave it public. In view of this, I would like to know the best way to 'hide' this key.
Below is part of the code referring to the question:
var endereco = "https://graph.facebook.com/"+ page_id +"/posts?access_token="+ token +"&limit=15";
$.getJSON(endereco, function(data) {
//função
});
Hide this key from whom? From the user himself? Or from a third party?
– mgibsonbr
Third party and the user himself. I use Jekyll and he has the option to host CMS on Github, as the source is opened in that repository, everyone will have access to my access_token. :(
– Phellipe Lins
While writing the answer I didn’t realize that I had edited the comment... Unfortunately, sending something to the user and hiding it from them are two conflicting objectives, I have nothing to suggest about it. The only way would be to use server-side encryption, but if you want the user himself to communicate with Facebook (calling the Graph API via Javascript in the browser) then at some point the user will have to have access to this token in the original form.
– mgibsonbr