I am trying to create a login authentication using Kinvey MBaaS. But it doesnts eem to be working any help?


#1

here is my code

var frameModule = require(“ui/frame”);
var dialogModule = require(“ui/dialogs”);
var Kinvey = require(‘kinvey-nativescript-sdk’).Kinvey;
var frameModule = require(‘ui/frame’);

var page;
var email;

exports.loaded = function(args){

page = args.object;

page.bindingContext = email;
}

//user login ccode
exports.login = function(){
email = page.getViewById(‘email’);
var promise = Kinvey.User.login(email.text)
.then(function(user) {
console.log(user);
frameModule.topmost().navigate(‘views/home/home’);
})
.catch(function(error) {
console.log(error);
dialogsModule.alert({
message: “Unfortunately we could not find your account”,
okButtonText: “OK”
});
});
}

exports.register = function(){
var topmost = frameModule.topmost();
topmost.navigate(‘views/signup/signup’);
}


#2

A little extra information of what the application does, how the Kinvey backend is setup, what you are trying to achieve - what the expected result is, and what the actual `doesn’t seem to be working’ manifests as, will be useful in helping solve your problem.


#3

the application only logs users in for now. i am new to nativescript and i considered using it for my final year projects. so its for study purposes for now.
the kinvey backend was set up with two users in a users collection which i created myself to authenticate against
after login the user is redirected to a homepage.
the app just freezes/crashes when i hit the login button

thank you


#4

Freezes/Crashes can be caused for a number of reasons. Crashes are normally accompanied by exception logs or stack traces.

If the project is indeed for the purposes of your studies, consider uploading it to GitHub so we can get a better idea of the context where your supposed crash is occurring.


#5

I wanted to share my experience with selecting a mobile backend for my app. I used to run my applications (I have several in the app store(s)) on Parse and was pretty happy with the backend until Facebook decided to shut down the service. After that I have evaluated all listed options and was not happy with any of them for various reasons. Firebase was not a good fit because the of their approach with JSON document being a database - I did a stress test with million nodes in the tree and the service was not performing well. AWS and Appery are quite complex and become expensive very quickly while Azure and CloudMine are quite limited in the capabilities. Kinvey is both limited and super expensive once you start doing something more serious in the app. In the end I chose Backendless (https://backendless.com) for my backend. The service has native SDKs for all major mobile and web platforms. The usability and developer experience is by far the best I have seen. The service has an extremely flexible server-side code model where I can deploy Java and JS server-side code to override default handling of the API and to create my own API services. My apps leverage social (Facebook, Twitter, Google) login, geolocation, file upload/download, push notifications (iOS, Android) and of course data persistence, which has really awesome support for complex relations. Check it out if you are looking for a flexible and very reasonably priced backend.