cordova-plugin-accountkit icon indicating copy to clipboard operation
cordova-plugin-accountkit copied to clipboard

Ionic: AccountKitPlugin.getAccount error : Server generated an error

Open lilian131 opened this issue 7 years ago • 1 comments
trafficstars

hello it is working good on ios but I get the error on android when executing AccountKitPlugin.getAccount Server generated an error no more please look at my code is there something to do to correct this code

phonelogin(){
    if (this.registerNum.length === 10) {
    localStorage.setItem('phone',this.registerNum);
    
      (<any>window).AccountKitPlugin.loginWithPhoneNumber({
            initialPhoneNumber: ["+966", this.registerNum],
            useAccessToken: true,
            defaultCountryCode: "SA",
            facebookNotificationsEnabled: true
          }, (successdata) => {
              (<any>window).AccountKitPlugin.getAccount((user) => {
                  this.tok = user;
                  this.presentLoader();
                  this.loginService.sendTokenToAPI(successdata)
                  .subscribe((user: any) => {
                        localStorage.setItem('token', "bearer " + user.token);
                        if (this.navParams.get("flag") == 0) {
                          this.navCtrl.setRoot("CartPage");
                        } else{
                          this.navCtrl.setRoot("HomePage");
                          this.socketService.establishConnection();
                          this.renderImage();
                          this.showToaster("User Successfully logged in !", 5000);
                        }
                        this.loader.dismiss();
                  }, (error) => {
                    this.loader.dismiss();
                    console.log(error);
                     if (error.error instanceof Error) {
                        alert('Client-side error occured.');
                     } else {
                      console.log(error);
                      this.message = error.stack;               
                        this.message = {message: this.message, str: this.message}                  
                        console.error(JSON.parse(this.message));                                                
                        console.error(error.message );

                    }
                  });
              }, (err) => {
                console.log("err");
                console.log(err);
                console.log("err");
              });
          }, (err) => {
            alert(err);
          })
    } else if ((this.registerNum.length < 10 || this.registerNum.length > 10) && this.registerNum.length > 0) {
        this.showToaster("the number format is not correct", 3000);
    } else if (this.registerNum.length === 0) {
        this.showToaster("please enter your phone number to login", 3000);
    }
  }

lilian131 avatar Aug 29 '18 10:08 lilian131

I have some error. Don't know how to get back user mobile number after authorization except calling .getAccount()

But it generates "Server generated an error" message

hadoanngoc avatar Nov 01 '18 10:11 hadoanngoc