Skip to content
Tauri
Releases

Deep Linking

Set your Tauri application as the default handler for an URL.

  • Android
  • iOS

This plugin requires a Rust version of at least 1.75

Install the deep-link plugin to get started.

Use your project’s package manager to add the dependency:

npm run tauri add deep-link

For app links, you need a server with a .well-known/assetlinks.json endpoint that must return a text response in the given format:

.well-known/assetlinks.json
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "$APP_BUNDLE_ID",
"sha256_cert_fingerprints": [
$CERT_FINGERPRINT
]
}
}
]

Where $APP_BUNDLE_ID is the value defined on tauri.conf.json > identifier with - replaced with _ and $CERT_FINGERPRINT is a list of SHA256 fingerprints of your app’s signing certificates, see verify android applinks for more information.

For universal links, you need a server with a .well-known/apple-app-site-association endpoint that must return a text response in the given format:

.well-known/apple-app-site-association
{
"applinks": {
"details": [
{
"appIDs": ["$DEVELOPMENT_TEAM_ID.$APP_BUNDLE_ID"],
"components": [
{
"/": "/open/*",
"comment": "Matches any URL whose path starts with /open/"
}
]
}
]
}
}

Where $DEVELOPMENT_TEAM_ID is the value defined on tauri.conf.json > tauri > bundle > iOS > developmentTeam or the TAURI_APPLE_DEVELOPMENT_TEAM environment variable and $APP_BUNDLE_ID is the value defined on tauri.conf.json > identifier. See applinks.details for more information.

You also need to add the associated domains to your app’s entitlements file:

src-tauri/gen/apple/[App Name]_iOS/[App Name]_iOS.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:your.website.com</string>
<string>applinks:nother.site.br</string>
</array>
</dict>
</plist>

See supporting associated domains for more information.

Under tauri.conf.json > plugins > deep-link, configure the domains you want to associate with your application:

tauri.conf.json
{
"plugins": {
"deep-link": {
"domains": [
{ "host": "your.website.com", "pathPrefix": ["/open"] },
{ "host": "another.site.br" }
]
}
}
}

The deep-link plugin is available in both JavaScript and Rust.

import { onOpenUrl } from '@tauri-apps/plugin-deep-link';
await onOpenUrl((urls) => {
console.log('deep link:', urls);
});

By default all plugin commands are blocked and cannot be accessed. You must define a list of permissions in your capabilities configuration.

See Access Control List for more information.

src-tauri/capabilities/main.json
{
"$schema": "../gen/schemas/mobile-schema.json",
"identifier": "mobile-capability",
"windows": ["main"],
"platforms": ["iOS", "android"],
"permissions": [
// Usually you will need event:default to listen to the deep-link event
"event:default",
"deep-link:default"
]
}
PermissionDescription
deep-link:defaultAllows reading the opened deep link via the get_current command.
deep-link:allow-get-currentEnables the get_current command without any pre-configured scope.
deep-link:deny-get-currentDenies the get_current command without any pre-configured scope.

© 2024 Tauri Contributors. CC-BY / MIT