Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Development Tunneling

When developing OAuth2 and Passkey authentication, you need HTTPS access from external devices (mobile testing) or to satisfy OAuth2 redirect URI requirements. This guide covers tunneling solutions.

Cloudflare Tunnel provides free, reliable tunneling without interstitial pages.

Installation

Install cloudflared from Cloudflare Downloads

Quick Start

  1. Create a quick tunnel (no account required):
cloudflared tunnel --url http://localhost:3001
  1. Note the generated URL (e.g., https://random-name.trycloudflare.com)

  2. Update your .env:

ORIGIN='https://random-name.trycloudflare.com'
  1. Update Google OAuth2 redirect URI to https://random-name.trycloudflare.com/o2p/oauth2/authorized

  2. Start your local server:

cd demo-both && cargo run

Why Cloudflare Tunnel?

  • No interstitial page - Direct tunneling without cookie dependencies
  • iOS compatible - Works reliably on iOS Safari (unlike ngrok free tier)
  • Free - Quick tunnels require no account
  • Stable - No session cookie issues

ngrok

ngrok is a popular alternative but has limitations on iOS.

Installation

Download from ngrok.com

Quick Start

  1. Create a tunnel:
ngrok http 3001
  1. Note the generated URL (e.g., https://random-name.ngrok-free.app)

  2. Update your .env:

ORIGIN='https://random-name.ngrok-free.app'
  1. Update Google OAuth2 redirect URI to https://random-name.ngrok-free.app/o2p/oauth2/authorized

  2. Start your local server:

cd demo-both && cargo run

iOS Limitation

ngrok’s free tier does not work on iOS Safari. The interstitial page requires a cookie that iOS Safari’s Intelligent Tracking Prevention (ITP) blocks for subresource requests.

For iOS testing, use Cloudflare Tunnel instead. See iOS Safari Compatibility for technical details.

Workaround

Upgrade to ngrok’s paid plan, which removes the interstitial page entirely.

Comparison

FeatureCloudflare Tunnelngrok (free)
iOS SafariWorksBroken
Interstitial pageNoneYes
Account requiredNo (quick tunnels)No
CostFreeFree

Recommendation: Use Cloudflare Tunnel for all development, especially when testing on iOS devices.