Launching app via deeplink & logging users in

Deep links allow external links to open your application directly and pass information to it. Instead of opening a website in a browser, a deep link launches your desktop app and provides parameters that your application can read and act on.

This makes it possible to trigger specific actions from outside your app, such as opening a page, loading a resource, or passing data into your application when it starts.


How To:

In this guide, you'll learn how to configure and handle deep links in your application.

We'll also walk through an example of authenticating users using a magic link, where a secure login link is included inside the deep link URL so the user can be automatically signed in when the app opens.

Step 1.

Firstly, we need to create a magic login link. We can do this by creating a backend WF that creates a magic link, and saves it to the current user.<br>

<figure><img src="https://909455594-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC8kwY8yODXmNxAtaN0Ej%2Fuploads%2FZEZqN8Fof8NHTULncRP8%2Fimage.png?alt=media&token=cc7f9fb2-e714-418f-9955-7bf4996a3796" alt=""><figcaption></figcaption></figure>

Step 2.

Once our magic login link is created and saved to the user, we can then create a WF that navigates to our deeplink, with our magic link as a parameter.

The deeplink is structured as follows:

<kbd>YourAppName://anyDataGoesHere</kbd>

<figure><img src="https://909455594-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC8kwY8yODXmNxAtaN0Ej%2Fuploads%2FVtzDRGtsEaFGX4IlnCN4%2Fimage.png?alt=media&token=a85b0070-857c-4828-82c2-fb3644d9c3fc" alt=""><figcaption></figcaption></figure>

In our case our app name is deskifier and we're adding a redirect_url parameter that has our magic link.

Step 3.

Next, we need to handle our deeplink data. We can check the Deeplink URL Used state, and navigate to the redirect_url inside our desktop app.

<figure><img src="https://909455594-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC8kwY8yODXmNxAtaN0Ej%2Fuploads%2FqTBAMDh7c80XoT0RGIwt%2Fimage.png?alt=media&token=6d5ae84b-c2db-43d4-aa4f-c9c811942ef3" alt=""><figcaption></figcaption></figure>

It's important to note a few things about the deeplink - If a deeplink is used by a user when your app isn't open, it will launch your app. In this case, the custom state will be populated when the app loads.

It's also possible that a user uses a deeplink while your app is already running. In this case, the custom state will be updated, and the App - Deeplink Used event will fire.