Kurt Biesemans
Posts: 0
Joined: Thu May 30, 2013 2:02 pm

Use the error response of the login service

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Use the error response of the login service

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

Kurt Biesemans
Posts: 0
Joined: Thu May 30, 2013 2:02 pm

Use the error response of the login service

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."
}

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Use the error response of the login service

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

Kurt Biesemans
Posts: 0
Joined: Thu May 30, 2013 2:02 pm

Use the error response of the login service

Hi Marina,

This works! Thank you for the help!

Kurt

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Use the error response of the login service

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

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Use the error response of the login service

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Use the error response of the login service

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

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Use the error response of the login service

yep ! happy too !

Return to “Issues”