Safeguard
Security Guides•

Custom scheme, claimed HTTPS or loopback: which OAuth redirect for apps?

RFC 8252 describes three ways a native app can receive an OAuth redirect. Which is safest on mobile and desktop, and what rules apply to each.

Safeguard Security Team
4 min read

For a mobile app, use a claimed HTTPS redirect URI where the platform supports it. RFC 8252 says native apps should prefer it, because the operating system guarantees the destination app's identity. Use a private use URI scheme as a fallback and a loopback address for desktop tools.

The three options

RFC 8252, the IETF guidance for OAuth in native apps, describes three ways to get the authorization response back into the app. All three start by opening the system browser, since native apps must not use embedded user agents for authorization requests.

OptionLooks likeSuitsMain caveat
Claimed HTTPShttps://app.example.com/oauth2redirect/providerMobile appsNeeds the platform's app link or universal link setup
Private use URI schemecom.example.app:/oauth2redirect/providerMobile apps where claimed links are not availableOther apps could register the same scheme
Loopbackhttp://127.0.0.1:port/pathDesktop apps that can open a local portNeeds a port, and may not suit all platforms

Claimed HTTPS

An app claims an https URL on a domain it controls. When the browser meets that URL, the operating system launches the app instead of loading the page. The authorization server sees an ordinary https redirect URI.

RFC 8252 gives the reason it is preferred: the identity of the destination app is guaranteed to the authorization server by the operating system. Because the URI alone does not tell a public native client from a confidential web client, the specification also requires that the client type be recorded at registration.

Private use URI scheme

Many platforms let apps register a custom scheme. RFC 8252 sets rules for it. The scheme must be based on a domain name the developer controls, written in reverse order, so an app that controls app.example.com can use com.example.app. A scheme such as myapp does not qualify. Only a single slash follows the scheme. Where an app has an identifier in reverse domain form, that identifier can be reused.

The weakness is that nothing stops a second app registering the same scheme. That is why PKCE matters here, since it prevents a stolen authorization code from being exchanged.

Loopback

Desktop apps that can open a local port can receive the redirect at http://127.0.0.1 or http://[::1] with a port. The authorization server must allow any port to be specified at request time, because the app picks an available one. Clients should not assume a particular IP version and should try to bind both IPv4 and IPv6.

What applies to all three

  1. Use the authorization code flow with PKCE.
  2. Open the system browser. RFC 8252 says native apps must not use embedded user agents for authorization requests.
  3. Register exact redirect URIs for each app, and record the client type.
  4. Do not treat a client secret shipped in an app as a secret. RFC 8252 says such secrets should not be treated as confidential.
  5. Check the state parameter on return, since RFC 8252 covers cross app request forgery protections.

How to choose

IfThen
The platform supports app links and you control a web domainClaimed HTTPS
Not, or you need to support older systemsPrivate use scheme with PKCE
Desktop tool with local port accessLoopback with PKCE

Safeguard's SBOM and dependency scanning shows the authentication libraries inside your app builds, and a free scan is available at gold.safeguard.sh/scan.

Related reading

Quick check

Is a custom scheme like myapp acceptable?

RFC 8252 says the scheme must be based on a domain name you control in reverse order, so a bare name like myapp does not meet the requirement.

Why prefer claimed HTTPS over a custom scheme?

The operating system verifies which app owns the link, so another app cannot simply register the same redirect.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.