Page 1 of 1

Use the error response of the login service

Posted: Thu May 30, 2013 2:02 pm
by Kurt Biesemans

Hi,

In my app I would like to use the login service. After the setup and implementing this in my app it works. Now as an extra I would like to use the error message (response) that you get back when an authentication error (wrong userID, wrong PWD) happens.

Is there any way to capture this response in for example a label?

Regards
Kurt


Use the error response of the login service

Posted: Thu May 30, 2013 2:54 pm
by maxkatz

Yes, you can use 'error' callback on the service: http://docs.appery.io/documentation/a...


Use the error response of the login service

Posted: Tue Jun 04, 2013 9:11 am
by Kurt Biesemans

Dear Max,

Thank you for your reply but how do I get the description out of the response

"status":"400 Bad Request",
"url":"https://api.appery.io/rest/1/db/login",
"response":{
"code":"DBUI106",
"description":"User name must be present."
}


Use the error response of the login service

Posted: Tue Jun 04, 2013 11:04 am
by Maryna Brodina

Hello! On service error event run the following code:
codevar label = Appery("errorLabelName");
try {
var answerObj = JSON.parse(jqXHR.responseText);
label.text(answerObj.description);
} catch ( e ) {
label.text("Unknown error");
}/code
errorLabelName - Label name where you want to show error message


Use the error response of the login service

Posted: Tue Jun 04, 2013 11:54 am
by Kurt Biesemans

Hi Marina,

This works! Thank you for the help!

Kurt


Use the error response of the login service

Posted: Sat Oct 24, 2015 11:59 pm
by EJLD

Hello, I could find the way to sign up, update, get, ... however, I am stuck with the sign in :( may I ask you how to pass the username and password.
I did as follows but got a 400 error "user name must be present"
thk you very much for your time
Image


Use the error response of the login service

Posted: Sun Oct 25, 2015 9:16 am
by EJLD

done! no need to look into this one, I managed to sign in :)
enjoy your week


Use the error response of the login service

Posted: Sun Oct 25, 2015 9:57 am
by Alena Prykhodko

Thank you for update, glad it's sorted out.


Use the error response of the login service

Posted: Sun Oct 25, 2015 10:38 am
by EJLD

yep ! happy too !