1

Im using Firebase for my backend solution with Angular. Im using signInWithEmailAndPassword from Firebase to log in the users. When a non valid user tries to log in i get some nasty console errors that it seems im not able to catch. I also tried using try-catch.

AuthService:

  loginWithUserPassword(user: string, password: string): Promise<any> {
return this.afAuth.signInWithEmailAndPassword(user, password)
  .then(() => {
    return true;
  })
  .catch((err) => {});}

The errors i get after wrong user in the console:

POST 400 webpack: zone.js:1518 https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=[ApiKey]

webpack: core.mjs:9171

ERROR Error: Uncaught (in promise): FirebaseError: Firebase: The password is invalid or the user does not have a password. (auth/wrong-password).
                                    
at createErrorInternal (index-c6def6da.js:474:41)
at _fail (index-c6def6da.js:445:11)
at index-c6def6da.js:976:17
at Generator.next (<anonymous>)
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at _next (asyncToGenerator.js:25:1)
at _ZoneDelegate.invoke (zone.js:372:26)
at Object.onInvoke (core.mjs:26274:33)
at _ZoneDelegate.invoke (zone.js:371:52)
at Zone.run (zone.js:134:43)
at resolvePromise (zone.js:1211:31)
at resolvePromise (zone.js:1165:17)
at zone.js:1278:17
at _ZoneDelegate.invokeTask (zone.js:406:31)
at Object.onInvokeTask (core.mjs:26261:33)
at _ZoneDelegate.invokeTask (zone.js:405:60)
at Zone.runTask (zone.js:178:47)
at drainMicroTaskQueue (zone.js:585:35)
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jan 07 '23 at 11:05
  • Please don't post screenshots of your code, or other textual content. Instead post the actual text, and use the formatting tools of Stack Overflow to mark it up. Also see: [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) – Frank van Puffelen Jan 07 '23 at 15:12
  • For the one more question, see https://stackoverflow.com/questions/37482366/is-it-safe-to-expose-firebase-apikey-to-the-public/37484053#37484053 – Frank van Puffelen Jan 07 '23 at 15:12

0 Answers0