Deep Linking
Configure URL schemes, universal links, and test deep links in your Expo app.
Deep Linking
ScaleRocket Mobile uses the scalerocket:// URL scheme for OAuth callbacks, email links, and custom navigation.
URL Scheme Configuration
The URL scheme is configured in app.json:
{
"expo": {
"scheme": "scalerocket"
}
}This allows the app to handle URLs like scalerocket://path/to/screen.
How Deep Links Are Used
ScaleRocket Mobile uses deep links for:
| Purpose | URL | Description |
|---|---|---|
| OAuth callback | scalerocket:// | Google/Apple sign-in redirects back to the app |
| Password reset | scalerocket://reset-password | Email reset link opens the app |
| Email confirmation | scalerocket://confirm | Email verification link opens the app |
Generating Redirect URIs
Use expo-linking to generate redirect URIs for OAuth:
import { makeRedirectUri } from "expo-linking";
const redirectUrl = makeRedirectUri({ scheme: "scalerocket" });
// Returns: scalerocket://Add this URL to your backend's allowed redirect URLs:
- Supabase: Authentication > URL Configuration > Redirect URLs
- Convex: Auth settings > Redirect URLs
Handling Custom Deep Links
Expo Router automatically maps deep link paths to screens. A deep link to scalerocket://settings navigates to app/(tabs)/settings.tsx.
To handle deep links programmatically:
import * as Linking from "expo-linking";
import { useEffect } from "react";
useEffect(() => {
// Handle deep link when app is already open
const subscription = Linking.addEventListener("url", ({ url }) => {
console.log("Deep link received:", url);
// Parse and navigate
});
// Handle deep link that opened the app
Linking.getInitialURL().then((url) => {
if (url) {
console.log("App opened via deep link:", url);
}
});
return () => subscription.remove();
}, []);Universal Links (iOS) and App Links (Android)
For links that work both in the browser and in the app (e.g., https://yourapp.com/invite/abc), configure universal links.
iOS Universal Links
Add the associated domains configuration to app.json:
{
"expo": {
"ios": {
"associatedDomains": ["applinks:yourapp.com"]
}
}
}Host an apple-app-site-association file on your domain:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAM_ID.com.scalerocket.app",
"paths": ["/invite/*", "/reset-password/*"]
}
]
}
}Android App Links
Add intent filters to app.json:
{
"expo": {
"android": {
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "yourapp.com",
"pathPrefix": "/invite"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}Testing Deep Links
In the Simulator/Emulator
# iOS Simulator
npx uri-scheme open scalerocket://settings --ios
# Android Emulator
npx uri-scheme open scalerocket://settings --androidOn a Real Device
# Using Expo CLI
npx expo start --dev-client
# Then open: scalerocket://settings in the device browserWith curl (Expo Go)
# Open the app via Expo's deep link proxy
npx uri-scheme open exp://127.0.0.1:8081/--/settings --iosChanging the URL Scheme
To use your own URL scheme instead of scalerocket://:
- Update
schemeinapp.json - Update all
makeRedirectUricalls - Update your backend's redirect URLs
- Rebuild the app (scheme changes require a new build)