No error handler for Auth.login #22
Comments
Currently, you would just do the following, essentially a typical promise handler: this.auth.login('basic', details).then( () => {
//success
}, (err) => {
// Do something with err such as
console.log(err.message);
}) If you were to use it incorrectly, say you spell the parameter keyword If login fails, it will say Or if the email is not actually an email (say instead of I do agree with you that the signup function's returned email object is quite a bit more useful, I will work on adding an improved error type for login. For now, I'll update the docs to include this more complete example. Thanks for the feedback! P.S.If you wanted to look more in depth at the implementation, you can see it here: |
Thanks for the completeness of the answer ! |
Query - is there any reason why error handling is done differently for registration versus login? I just assumed I could follow the same pattern and expect IDetailedError<string[]>, but obviously that is not the case. |
As an example, sending "pp" as the email address gives you UNPROCESSABLE ENTITY. Compare that to the nice invalid_email you get from registration. Is there a reason why this is being handled a bit more rough? |
@cfjedimaster Fair question, i'll see what we can do about that. 🤔 |
With ionic 2.0 finished and the current focus on the services, can we expect any improvements in this area the next couple of weeks? Without getting back detailed errors, building a user-friendly authentication system is impossible. |
It seems to me as if the error handler never gets called, when custom auth with a hidden inAppBrowser is used. This ionic-cloud issue is related, but also closed: ionic-team/legacy-ionic-cloud#53 |
Hello,
I am trying to show error when a login attempt is done.
However, I can't find in the documentation https://docs.ionic.io/services/auth/#login if there is any error handler for login method.
There is one existing for the signup method and is working well.
Does it exist ? if yes, is it possible to update the doc ?
Thanks.
Your system information:
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Windows 7 SP1
Node Version: v6.6.0
The text was updated successfully, but these errors were encountered: