I want to use two photos from the data base as login values (key1, key2)
I currently have these values as files in the USER collection, and adapted a login script to look for these values instead of username and password. I tested the service in the run tab and got a 400 error... How do I implement this? with many thanks FYI.... I put my real database_id where "mydatabase_id" is on the the code listed below, I just didnt want to post it .....
// This scripts logs a user in and retreives any additional information
// from the UserProfile collection
var databaseId = "mydatabase_id";
var key1 = request.get("key1");
var key2 = request.get("key2");
try {
// User login
var userLoginInfo = DatabaseUser.login(databaseId, key1, key2);
// Retrieve any additional information from UserProfile collection
// linked from the Users collection
var userProfile = DatabaseUser.retrieve(databaseId, userLoginInfo._id, "ptProfile", userLoginInfo.sessionToken);
var userData = {
"session": userLoginInfo.sessionToken,
"username": userProfile.username
};
response.success(userData, "application/json");
} catch (error) {
response.error({
"message": "Incorrect key1 or key2."
}, 400);
}