Using Barcode Scanner

Hi guys

Basically, i am creating an App where a user need to scan his QR code to be able to access his data, i am desperately stuck on how to use the

`cordova:com.phonegap.plugins.barcodescanner

Meteor.startup(() => {

if (Meteor.isCordova) {

Template.barcode_scanner.events({
‘click .scan’: function () {

  cordova.plugins.barcodeScanner.scan(
    function (result) {
      alert("We got a barcode\n" +
        "Result: " + result.text + "\n" +
        "Format: " + result.format + "\n" +
        "Cancelled: " + result.cancelled);
    }, 
    function (error) {
      alert("Scanning failed: " + error);
    }
 );

}

});

}
else{
console.log(“no cordova here…”);
}

});

`

How to store the data to be accessed ?
How can i attached it to the QR code for a specific user?

Is there any way to do this better?

Please Help!

Thank You So Much.
Love,
Laurent Kouassi,

Is this the only way the user gets access? or does he have a password too?
Anyway, I would suggest making use of the meteor accounts-passwords package, just use the text in the result object you receive from the scanner as the password:

Meteor.loginWithPassword(
   username,
   result.text,
   function(err){
      if(!err){
      //do something if succeeded in logging in
      }
      },
   );

Alternatively, you can create a collection of usernames and qr-codes and query it with a Method.
Keep in mind that this will mean that you will lose the encryption the accounts package provides out of the box…