gurisko / cordova-plugin-accountkit

AccountKit Plugin for Apache Cordova which allows you to add passwordless email and SMS authentication to your app
MIT License
34 stars 42 forks source link

integration with ionic 2 #22

Open mrpower55 opened 7 years ago

mrpower55 commented 7 years ago

it is really looking nice and i want to ask if this is compatiable with ionic 2 i tried to download it but i don't know how to import it in my typescript file

so please if anyone know how please tell me thanks

gurisko commented 7 years ago

Have you tried window['AccountKitPlugin'].method() ?

gurisko commented 7 years ago

Closing due to inactivity.

rajbisht13 commented 7 years ago

Hi gurisko! can we use this plugin in ionic 2

gurisko commented 7 years ago

Hello. Yes, I had no troubles using it with Ionic2.

On 5 Jun 2017 2:27 p.m., "Raj Bisht" notifications@github.com wrote:

Hi gurisko! can we use this plugin in ionic 2

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gurisko/cordova-plugin-accountkit/issues/22#issuecomment-306175580, or mute the thread https://github.com/notifications/unsubscribe-auth/AAePvYg0h4pwTs-5ZvcOevCrcv6aANb2ks5sA_RMgaJpZM4Mjtte .

rajbisht13 commented 7 years ago

Ohk, and what about ionic 3? btw, thanks gurisko

gurisko commented 7 years ago

I haven't tested with Ionic 3, but there were no major changes (other than angular itself which doesn't really touch Cordova plugins) so it should be working fine. You're welcome. And please let us know if everything works as expected if you decide to proceed with the implementation.

On 5 Jun 2017 3:30 p.m., "Raj Bisht" notifications@github.com wrote:

Ohk, and what about ionic 3? btw, thanks gurisko

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gurisko/cordova-plugin-accountkit/issues/22#issuecomment-306187633, or mute the thread https://github.com/notifications/unsubscribe-auth/AAePvY8UGxUfxsF1_I77DJy2OF-egzHGks5sBALtgaJpZM4Mjtte .

rajbisht13 commented 7 years ago

Hi gurisko, I am trying to use this plugin in my ionic3 project. Can you please tell is this correct way of implementing the plugin.

declare var AccountKitPlugin:any; 
export class LoginPage {
result: any;
constructor(public navCtrl: NavController){
}
smsLogin() {
    let options = {
      defaultCountryCode: "IN",
      facebookNotificationsEnabled: true,
      initialPhoneNumber: ["+91", this.userDetail.value.phoneNumber]
    }  
    let that = this;
    let success = function(response){
        that.result = response;
        console.log(that.result);
        that.navCtrl.push('TabPage');
     }
    let error = function(err){
       return error;
    }    
    AccountKitPlugin.loginWithPhoneNumber(options, success, error);
}   
gurisko commented 7 years ago

It seems good to me. Doesn't it work? I'll have a look when I have access to my laptop.

On 5 Jun 2017 7:51 p.m., "Raj Bisht" notifications@github.com wrote:

Hi gurisko, I am trying to use this plugin in my ionic3 project. Can you please tell is this correct way of implementing the plugin.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gurisko/cordova-plugin-accountkit/issues/22#issuecomment-306256614, or mute the thread https://github.com/notifications/unsubscribe-auth/AAePvUojlDEewbW8TNh35_6bh0VRJi6dks5sBEAIgaJpZM4Mjtte .

rajbisht13 commented 7 years ago

Hi! it works perfectly fine but when i navigate to 'Tabpage', TabPage responds very slowly and bit buggy ( still don't know why! ) So i just removed 'that.navCtrl.push(TabPage)' from the success function and placed outside it, then it works perfectly fine. Thanks, gurisko!

khinchotin commented 7 years ago

I am using cordova-plugin-accountkit but I cannot chage colors in FacebookAccountKitLogin.xml for android platform ionic 2.

Thanks!

kkrishnan90 commented 7 years ago

Hello.. Doesn't seem to work for me... throws me the below error ...

Failure Class not found

I have just copied the above code trying to even hard code the phone number... but no luck.. here's my code

let options = {
      defaultCountryCode: "IN",
      facebookNotificationsEnabled: true,
      initialPhoneNumber: ["+91", "xxxxxxxxxx"]
    }  
    let that = this;
    let success = function(response){
        that.result = response;
        console.log(that.result);
     }
    let error = function(err){
      console.log(error)
       return error;
    }    
    AccountKitPlugin.loginWithPhoneNumber(options, success, error);

Any help on this is much appreciated as this is only live plugin available for account kit as much as I've seen through the entire internet.

sharmila-r commented 7 years ago

Hi, I am trying to use this plugin in Ionic 3 and I am not sure how to import this plugin in my ts file.

I followed the sample code of Whhymee which he mentioned in his comment but I am getting 'AccountKitPlugin is not defined'. I am new to Ionic and I am not sure what I am missing here. Package.json and config.xml has this plugin with name as 'cordova-plugin-accountkit'. Where else I have to make the change to use this plugin in Ionic 3.

Any help is appreciated! Thank you

rajbisht13 commented 7 years ago

@sharmila-r I think you need to add 'declare var AccountKitPlugin: any;' in your ts file. go through this link https://www.joshmorony.com/using-cordova-plugins-in-ionic-2-with-ionic-native/

sharmila-r commented 7 years ago

@Whhymee, thank you for the reply. I have declared the variable after import as 'declare var AccountKitPlugin:any; ' and still getting that error. Do I need to add anything in app.module.ts? Here is my login.ts code.

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, AlertController , Platform} from 'ionic-angular';
declare var AccountKitPlugin:any; 

@IonicPage()
@Component({
  selector: 'page-login',
  templateUrl: 'login.html',
})
export class LoginPage {
    public verificationId = "";
    result: any;

constructor(public platform: Platform, public navCtrl: NavController,
    public navParams: NavParams,  public alertCtrl:AlertController) {
      platform.ready().then(() => {
        //console.log("cordova ",cordova.plugins)
       });
    }
    registerPhone(phoneNumber): void {
      let options = {
        defaultCountryCode: "US",
        facebookNotificationsEnabled: true,
        initialPhoneNumber: ["1", phoneNumber]
        };
        let that = this;
        let success = function(response){
            that.result = response;
            console.log(that.result);
            that.navCtrl.push('TabPage');
         }
        let error = function(err){
           return error;
        }    
    AccountKitPlugin.loginWithPhoneNumber(options, success, error);
    }
}

Thank you in advance!

sunilkunapareddy commented 6 years ago

@sharmila-r i have the same error... if you solved it please update here

sunilkunapareddy commented 6 years ago

@Whhymee the link which you gave is not working dude... plz update with this error

PavaniDasari8 commented 6 years ago

that doesn't work on browser, Only works on mobile device

MUsman888 commented 6 years ago

hey guys i am having trouble while installing account kit plugin. can anyone help me ? screenshot 251

PavaniDasari8 commented 6 years ago

hey guys i am having trouble while installing account kit plugin. can anyone help me ? screenshot 251

please check the command that you have used to install