You want to use a password protected feed in the Klip you are building. This means that you can't just put the feed location in the Klip's <contentsource> tag because the user has to provide a username and password.
The general idea is to provide the user with a way to enter a login and password, then construct the feed URL based on what the user enters.
During your onLoad() function, add the following:
var tab = Setup.addTab("User Information"); tab.addText("Please enter your username:"); c_username = tab.addTextField(''); tab.addText("Please enter your password:"); c_password = tab.addTextField(''); c_password.obscured = true;
During the onRefresh() function, add the following:
var feedURL = "http://" + c_username.value + ":" + c_password.value + "@" + feedLocation; Engines.KlipFood.process(feedURL);
There is one important thing to note concerning password security. When saving the user's username and password as preferences, the password should be "garbled":
Prefs.setPref("password", garble(c_password.value));
This obscures the password value that is saved in the Klip's preferences file. If the garble() function is not used, then the password is stored as plaintext in the user's KlipFolio profile, which could then be read by another person. When loading the password pref, use the coresponding ungarble() function:
c_password.value = ungarble(Prefs.getPref("password"));