How can I use launchmyapp with Meteor for check-email link?

I am using the Meteoric package to run Ionic in my meteorite application. I would like to use https://github.com/EddyVerbruggen/Custom-URL-scheme (nl.x-services.plugins.launchmyapp plugin) in my application. I'm actually using it, but it doesn't work correctly.

I am trying to use this plugin to deep link from a url to my application. Right now I'm just trying to get it to work with the check-email line. I click on the link and it takes me to the app, but it always wants me to login first.

The link you send looks like this.

myappname://verify-email/longtokenidhere1212332

      

If I click on this, my app starts, but it always asks for user credentials rather than validating the email address.

Update 1:

It almost works for me. I have added handleOpenURL as a global function as shown below

Meteor.startup(function() {
    handleOpenURL = function handleOpenURL(url) {
        var token = url.replace("myappname://verify-email/", "");
        console.log("Token: " + token);
        Router.go('/verify-email/', {"paramToken": token});
    }
});

      

I can now see marker printing on the console.

But when it is routed, I get the route of the page not found. How can I print the current url from the console to see if I am hitting the correct full url? I tried window.URL, but this prints the URLConstructor () object.

+3


source to share


1 answer


"/ verify-email" is not an iron router route; it was baked in the meteor itself.

So, instead of Router.go (), you can call Accounts.verifyEmail from the client, for example:



Meteor.startup(function() {
    handleOpenURL = function handleOpenURL(url) {
        var token = url.replace("myappname://verify-email/", "");
        console.log("Token: " + token);
        // mark this client email as verified by using the token
        Accounts.verifyEmail(token, 
            function(error){
               if (error) {
                   console.log("email not verified");
               } else {
                   console.log("email verified successfully!");
               }
            }
        );
    }
});

      

+1


source







All Articles