Problem in auth user “First argument ”email“ must be a valid string” Ionic

I'm having trouble with my ionic signup and login page, I've did all i can to fix but i dont know the kind of error,can someone please explain, I cant login now or signup. I used firebase realtime database as backend, I cant tell what the trouble is.

code: "auth/argument-error" ​

message: "createUserWithEmailAndPassword failed: First argument "email" must be a valid string." ​

ngDebugContext: Object { view: {…}, nodeIndex: 56, nodeDef: {…}, … } ​

ngErrorLogger: function logError() ​ stack: ""

HTML

  <ion-content [fullscreen]="true" class="ion-padding">
  <div class="container">
   
   <div class="title">
     <span>Welcome to</span>
     <h2>Scrow Mobile App</h2>
     <p>Signup to start experiencing best bitcoin features.</p>
   </div>
 
   <div class="form">
     <div>
      <ion-item>
     <ion-icon slot="start" name="person-outline"></ion-icon>
        <ion-input type="text" placeholder="Full Name" [(ngModel)]="name"></ion-input>
      </ion-item>

      <ion-item>
        <ion-icon slot="start" name="at-circle-outline"></ion-icon> 
           <ion-input type="text" placeholder="Username" [(ngModel)]="username"></ion-input>
         </ion-item>

       <ion-item>
        <ion-icon slot="start" name="mail-outline"></ion-icon>
         <ion-input type="text" placeholder="Email" [(ngModel)]="email"></ion-input>
       </ion-item>

       <ion-item>
         <ion-icon slot="start" name="key-outline"></ion-icon>
         <ion-input type="password" placeholder="Password" [(ngModel)]="password"></ion-input>
       </ion-item>

       <ion-button expand="block" (click)="register()">
         <div class="btn-container">
           <span>Sign Up</span>
         <ion-icon name="arrow-forward-outline"></ion-icon>
         </div>
       </ion-button>
     </div>
     <div class="ion-text-center">
       <span>Have an account? <a [routerLink]="[ '/login']">Sign In</a></span>
     </div>
   </div>
 
  </div>
   
 </ion-content>

register.page.ts

import { Component, OnInit } from '@angular/core';
import { LoginService } from '../services/login.service';

@Component({
  selector: 'app-register',
  templateUrl: './register.page.html',
  styleUrls: ['./register.page.scss'],
})
export class RegisterPage implements OnInit {
  name: any;
  username: any;
  email: any;
  password: any;
  img: any;

  constructor(
    private loginService: LoginService
  ) { }

  ngOnInit() {
  }

  register() {
    this.loginService.register(this.name, this.username, this.email, this.password, this.img);
  }
}

loginService

import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFireDatabase } from '@angular/fire/database';
import { auth } from 'firebase/app';

import { LoadingService } from './loading.service';
import { Platform } from '@ionic/angular';

import { environment } from 'src/environments/environment.prod';
import { Router } from '@angular/router';

@Injectable({
  providedIn: 'root'
})
export class LoginService {

  constructor(
    private afAuth: AngularFireAuth,
    private afdb: AngularFireDatabase,
    private loadingProvider: LoadingService,
    private platform: Platform,
    private router: Router,
  ) { }

  login(email, password) {
    this.afAuth.auth.signInWithEmailAndPassword(email, password).then((res) => {
      console.log(res)
    }).catch(err => {
      console.log(err);
    })
  }

  register(name, username, email, password, img) {
    this.loadingProvider.show();
    this.afAuth.auth.createUserWithEmailAndPassword(email, password).then((res) => {
      let user: any = this.afAuth.auth.currentUser;
      this.loadingProvider.hide();
      this.createNewUser(user.uid, name, username, user.email, "I am available", "Firebase", img);
    }).catch(err => {
      console.log(err);
      this.loadingProvider.hide();
      this.loadingProvider.showToast(err.message);
    })
  }

Thanks in advance



Read more here: https://stackoverflow.com/questions/64559416/problem-in-auth-user-first-argument-email-must-be-a-valid-string-ionic

Content Attribution

This content was originally published by Marc Lovato at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: