I would like to use cartodb.js in my web page reproduce a visualization that I created at CartoDB. But I want to keep private my visualization and data at CartoDB (and I am going to secure my web page).
Is there a way to use the APIs in cartodb.js with my CartoDB API key somehow to reproduce in my web page the private visualization that I see on my CartoDB site?
I've been studying the documentation, examples, and source code for cartodb.js. As far as I can tell, cartodb.js does not really provide for use of my API key, but perhaps I am missing something.
Best Answer
Take a look at this example I wrote a while back,
https://github.com/andrewxhill/cartodb-examples/blob/gh-pages/private-maps/index.html
It would present you with a form where you drop your api-key and it will create the map. You can use it as a starting point if you just want to write your api_key directly into the file.
The way to do it in the library is to create a layer with
extra_params
,We are also going to be released a new tier of privacy for maps in the coming weeks. It will allow you to publish maps from private data.