I'm using the Meteoric package to run ionic on my meteor app. I'd like to use the https://github.com/EddyVerbruggen/Custom-URL-scheme (nl.x-services.plugins.launchmyapp plugin) in my app. Actually I am using it, but it isn't working right.
I'm trying to use this plugin to deep link from a URL into my app. Right now I'm just trying to get it to work with the verify-email link. I click the link and it takes me into the app, but it always wants me to login first.
The link that is being sent looks like this.
myappname://verify-email/longtokenidhere1212332
If I click this my app does launch, but it always ask for the user login credentials instead of verifying the email address.
Update 1:
I have this almost working. I added handleOpenURL as a global function like 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});
}
});
Now I do see the token print to the console.
But when it routes I get a route not found page. How can I print the current URL from the console to see if I'm getting to the right full URL path? I tried window.URL, but that prints the URLConstructor() object.
"/verify-email" is not an iron router route; it's baked into meteor itself.
So instead of Router.go(), you can make a call to Accounts.verifyEmail from the client, like this:
Meteor.startup(function() {
handleOpenURL = function handleOpenURL(url) {
var token = url.replace("myappname://verify-email/", "");
console.log("Token: " + token);
// mark this client's 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!");
}
}
);
}
});