URI vs URL vs URN: Why It Matters for Redirect URIs

Markaretta DofourMarkaretta Dofour11 min read

A URI (Uniform Resource Identifier) is any string that identifies a resource. A URL (Uniform Resource Locator) is a URI that also tells you how to locate the resource, such as https://app.example.com/callback, and a URN (Uniform Resource Name) names a resource without saying where it is, such as urn:isbn:0451450523. Every URL is a URI, but not every URI is a URL, which is why OAuth says “redirect URI”: a native app’s custom scheme like com.example.app:/callback is a valid redirect even though no browser could look it up as a web address.

All three terms come from RFC 3986, section 1.1.3, which says “A URI can be further classified as a locator, a name, or both.” For most of your day the difference is academic, but in OAuth and OpenID Connect settings it decides which values you may register, how the authorization server compares them, and why a login fails over one trailing slash. This post gives you the definitions first and then spends its second half on redirect URIs, with examples from Keycloak’s Valid redirect URIs setting.

Key takeaways

  • A URL is the subset of URIs that also gives “a means of locating the resource” (RFC 3986, section 1.1.3). A URN is “a persistent, location-independent resource identifier” (RFC 8141, section 1).
  • OAuth requires the redirect to be “an absolute URI” with no fragment (RFC 6749, section 3.1.2), so custom schemes for native apps are allowed.
  • Authorization servers “MUST utilize exact string matching except for port numbers in localhost redirection URIs of native apps” (RFC 9700, section 2.1), so case, slashes and ports all count.
  • Browsers parse addresses with the WHATWG URL Standard, which aims to “obsolete” RFC 3986 (WHATWG URL Standard, Goals), and the gap between the two parsers is a known source of redirect bugs.

This post is organized in two parts:

  1. The definitions: what a URI, a URL and a URN are, with a comparison table and the examples from RFC 3986.
  2. Redirect URIs in practice: why OAuth uses the word URI, custom schemes and loopback redirects for native apps, exact matching, the retired out-of-band URN and parser differences.

What is the difference between a URI, a URL and a URN?

What is a URI?

A URI is a short string that identifies something, whether that is a web page, a mailbox, a phone number or a book. RFC 3986 gives every URI the same general shape, scheme ":" hier-part [ "?" query ] [ "#" fragment ] (RFC 3986, section 3). The scheme comes first and decides how the rest is read, so https, mailto, tel and urn are all schemes, and so is a made-up one like com.example.app as long as it follows the syntax rules.

The examples RFC 3986 lists in section 1.1.2 show how wide the term is:

ftp://ftp.is.co.za/rfc/rfc1808.txt
http://www.ietf.org/rfc/rfc2396.txt
ldap://[2001:db8::7]/c=GB?objectClass?one
mailto:John.Doe@example.com
news:comp.infosystems.www.servers.unix
tel:+1-816-555-1212
telnet://192.0.2.16:80/
urn:oasis:names:specification:docbook:dtd:xml:4.1.2

Every line is a URI. The first, second and seventh tell a program which protocol to use and which host to contact, and the last one names a document type without saying where any copy of it lives.

What is a URL?

A URL is a URI that also describes how to reach the resource, usually through its protocol and network address. RFC 3986 defines URL as “the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network ‘location’)” (RFC 3986, section 1.1.3). When you type https://skycloak.io/blog/ into a browser, the scheme says “use HTTPS”, the authority says which host to connect to and the path says which resource to ask for, so the string both identifies and locates the page.

What is a URN?

A URN is a URI that names a resource and stays valid even if the resource moves or no copy is online. Its syntax is "urn" ":" NID ":" NSS (RFC 8141, section 2), where the NID is a registered namespace such as isbn and the NSS is the name inside that namespace. RFC 8141 describes the goal as “a persistent, location-independent resource identifier” (RFC 8141, section 1).

URI vs URL vs URN at a glance

URI URL URN
What it does Identifies a resource Identifies and locates a resource Names a resource, with no location
Relationship The umbrella term A kind of URI A kind of URI
Typical form scheme:rest https://host/path urn:NID:NSS
Example com.example.app:/callback https://app.example.com/callback urn:isbn:0451450523
Defined in RFC 3986 RFC 3986, section 1.1.3 RFC 8141

In everyday speech people say URL for anything starting with https://, and that is fine. RFC 3986 itself recommends that specifications use the general term URI rather than the narrower URL and URN (RFC 3986, section 1.1.3), while the WHATWG URL Standard that browsers follow goes the other way and says “Standardize on the term URL. URI and IRI are just confusing” (WHATWG URL Standard, Goals). Both camps agree on the strings; they disagree on the word, and, as we will see below, on some of the parsing.

Why does OAuth say redirect URI and not redirect URL?

OAuth says redirect URI because the value does not have to be a web address. RFC 6749, section 3.1.2 requires only that “The redirection endpoint URI MUST be an absolute URI” and that it “MUST NOT include a fragment component.” An absolute URI has a scheme, so https://app.example.com/callback qualifies, and so does com.example.app:/callback, which only a phone’s operating system knows how to deliver.

That choice of word is what lets one protocol serve web apps, mobile apps and desktop tools. A web app receives the authorization code at an HTTPS address it hosts. A mobile app cannot host one, so the browser hands the code to the app through a scheme the app has claimed. OpenID Connect builds on OAuth 2.0 and keeps the same redirect_uri parameter, so the same rules apply to your OIDC clients.

How do native apps use custom schemes and loopback redirects?

RFC 8252, “OAuth 2.0 for Native Apps”, describes the redirect options for apps that run on a device. Two of them are plain URIs that are not ordinary web URLs.

  • Private-use URI schemes. The app registers its own scheme with the operating system. RFC 8252 says “apps MUST use a URI scheme based on a domain name under their control, expressed in reverse order”, and gives the example that an app controlling “app.example.com” can use “com.example.app” as its scheme (RFC 8252, section 7.1).
  • Loopback redirects. A desktop app or command-line tool starts a small web server on the machine and receives the code at an address such as http://127.0.0.1:53682/callback. Because the port is picked at run time, “The authorization server MUST allow any port to be specified at the time of the request for loopback IP redirect URIs” (RFC 8252, section 7.3). RFC 8252 prefers the IP literal, and says “the use of localhost is NOT RECOMMENDED” (RFC 8252, section 8.3).

Keycloak accepts both kinds in a client’s Valid redirect URIs. Our guide to OAuth for mobile apps with Keycloak registers io.skycloak.app:/callback beside an HTTPS address and explains why claimed HTTPS links are safer than custom schemes in production, since another app can claim the same scheme. For loopback, Keycloak retries the match without the port when an http redirect’s host is localhost, 127.0.0.1 or [::1], so a client registered with http://127.0.0.1/callback accepts that path on any port (Keycloak RedirectUtils.java, 26.8.0), as we traced for our post on redirect URI parser confusion. Native apps are public clients that cannot keep a secret, so pair either redirect with PKCE, which our walkthrough of creating a PKCE authorization flow client in Keycloak sets up.

What happened to the urn:ietf:wg:oauth:2.0:oob redirect?

The value urn:ietf:wg:oauth:2.0:oob is a URN, and for years it was the most common redirect URI that was not a URL at all. “OOB” means out-of-band: instead of redirecting, the authorization server showed the code on a page and the user copied it into the app by hand. Google, one of the providers that popularized it, described it as “a legacy flow developed to support native clients which do not have a redirect URI like web apps” and deprecated it because “The OOB flow poses a remote phishing risk” (Google Developers Blog, February 2022). Its key dates were “Feb 28, 2022 - new OAuth usage will be blocked for the OOB flow” and “Oct 3, 2022 - the OOB flow is deprecated for existing clients” (same source).

The value does not appear in RFC 8252, which steers native apps to the custom scheme and loopback options above. If an old desktop tool or script in your estate still sends it, move it to a loopback redirect before you rely on it.

Patched on the day, not on your next maintenance window

Keycloak 26.7.2 fixed CVE-2026-18963, an account takeover through password reset. Skycloak had it available for auto-upgrade and told customers the same day upstream shipped it. Self-hosted teams schedule that work themselves.

How does exact redirect URI matching work?

The authorization server compares the redirect_uri in the request with the URIs registered for the client, character by character. RFC 6749 already said the server “MUST compare the two URIs using simple string comparison as defined in [RFC3986] Section 6.2.1” (RFC 6749, section 3.1.2.3), and the current security best practice tightens that to a requirement to “utilize exact string matching except for port numbers in localhost redirection URIs of native apps” (RFC 9700, section 2.1).

Four sent redirect URIs compared with two registered ones: the exact match and the loopback with a new port are accepted, the trailing slash and upper-case scheme are rejected

The client registers https://app.example.com/callback and http://127.0.0.1/callback. The identical string is accepted, the trailing slash and the upper-case scheme are rejected, and the loopback address on port 53682 is accepted because loopback ports may vary.

This is where the URI definitions bite. RFC 3986 says “the scheme and host are case-insensitive” (RFC 3986, section 6.2.2.1), so HTTPS://App.example.com/callback and https://app.example.com/callback identify the same resource. A simple string comparison still treats them as different, because it does not normalize anything first. In practice, these are the differences that break logins:

  • Trailing slashes. /callback and /callback/ are different strings, and often different resources too.
  • Case. An upper-case letter anywhere in the value fails an exact comparison, even in the scheme or host.
  • Ports. https://app.example.com:443/callback is not the same string as https://app.example.com/callback, and outside loopback a changed port is a mismatch.
  • Scheme. A reverse proxy that makes your app think it runs on http produces an http:// redirect that no https:// registration matches.
  • Fragments. A value with # is not a valid redirect URI at all, per RFC 6749.

How do wildcards work in Keycloak’s Valid redirect URIs?

Keycloak compares exact registrations as plain strings and also lets you end a registration with *, which turns it into a prefix match, so https://app.example.com/* accepts any path on that origin. The wildcard only works at the end: Keycloak does not support a subdomain wildcard such as https://*.example.com/callback, so you list each host instead, as our redirect URI mismatch troubleshooting guide shows. Keycloak turns wildcard matching off when the sent value carries userinfo (anything before an @ in the host part), and a bare * registration matches everything, which you should never use outside a throwaway test realm (Keycloak RedirectUtils.java, 26.8.0; parser confusion post).

A wildcard is a deliberate step away from the exact matching that RFC 9700 asks for, so keep wildcards for development and register full redirect URIs in production. Keycloak also rejects redirect URIs that already carry OIDC response parameters such as state or code, a check in Keycloak RedirectUtils.java that started in the July 2026 releases, beginning with Keycloak 26.7.0, and that our post on the Keycloak 26.8 redirect URI parameter pollution change covers.

Why do URL parsers disagree, and why is that a security problem?

Two standards describe how to read these strings. RFC 3986 is the generic URI syntax that most server libraries follow. Browsers follow the WHATWG URL Standard, whose stated goal is to “Align RFC 3986 and RFC 3987 with contemporary implementations and obsolete the RFCs in the process” (WHATWG URL Standard, Goals). For well-formed https addresses they agree, but on unusual input they can return different hosts for the same string.

The backslash is the classic case. The WHATWG standard records a validation error when “The URL has a special scheme and it uses U+005C (\) instead of U+002F (/)” (WHATWG URL Standard, section 1.1), but its parser still reads the backslash as a path separator, while an RFC 3986 parser treats it as an ordinary character. In our parser confusion post we ran http://evil.example\@127.0.0.1/cb through Python and Node 22: Python reports the host as 127.0.0.1, and Node’s WHATWG URL reports evil.example. A server that validates with one reading and lets the browser follow the other can send the authorization code to an attacker.

Exact string matching is the main defence, because a server that never parses the value cannot be confused by it. Keycloak also parses the incoming value with java.net.URI and rejects strings it cannot parse (Keycloak RedirectUtils.java, 26.8.0), which stops that backslash example before matching. Your own code is a different matter: if your app, a gateway or a custom authenticator builds or checks redirect URIs, compare whole strings against an allow list rather than parsing out a host and comparing that.

Frequently asked questions

Is every URL a URI?

Yes. RFC 3986 defines a URL as a subset of URIs, the ones that also describe how to locate the resource (RFC 3986, section 1.1.3). The reverse is not true: urn:isbn:0451450523 and com.example.app:/callback are URIs, but neither gives a network location you could fetch.

Is a redirect URI the same as a callback URL?

In practice, yes: both terms mean the address where the authorization server sends the user back with the code or tokens. “Callback URL” is the informal name many SDKs and dashboards use, and “redirect URI” is the term in RFC 6749 and the redirect_uri parameter. The spec’s word is broader because the value can be a custom scheme for a native app, not only an HTTPS address.

Can I use localhost as a redirect URI?

You can, but RFC 8252 says “the use of localhost is NOT RECOMMENDED” for native apps and prefers a loopback IP literal such as 127.0.0.1 (RFC 8252, section 8.3). For http redirects, Keycloak’s port allowance covers localhost, 127.0.0.1 and [::1] (Keycloak RedirectUtils.java, 26.8.0), so register the path once without a port.

Why does my login fail when the redirect URI looks right?

Usually one character differs: a trailing slash, an http scheme behind a proxy, a port, or the case of a letter. Copy the redirect_uri from the failing request, compare it with each registered value character by character, and work through our redirect URI mismatch troubleshooting guide.

Can a redirect URI contain a query string?

Yes. RFC 6749 allows a query component in the redirection endpoint URI and says it “MUST be retained when adding additional query parameters” (RFC 6749, section 3.1.2). Recent Keycloak releases reject a redirect URI whose query already carries a response parameter such as state or code (Keycloak RedirectUtils.java, 26.8.0), so keep only your own parameters there.

What to do next

Open each client in your realm and read its registered redirect URIs against the matching rules above: full URIs rather than wildcards in production, 127.0.0.1 with no port for loopback, reverse-domain custom schemes for mobile, and no leftover out-of-band URN. If a login still fails after that, our redirect URI mismatch troubleshooting guide walks through each cause. And if you would rather not run the Keycloak underneath your clients yourself, we run it for you with managed Keycloak hosting.

Patched on the day, not on your next maintenance window

Keycloak 26.7.2 fixed CVE-2026-18963, an account takeover through password reset. Skycloak had it available for auto-upgrade and told customers the same day upstream shipped it. Self-hosted teams schedule that work themselves.

Markaretta Dofour
Written by
Content Writer, Skycloak

Markaretta is Skycloak's content writer. She proposes topics, writes posts and pages for search and AI answers, and watches how they perform. She keeps to the answer first and never uses a number or quote without its source.

© 2026 Skycloak. All Rights Reserved. Design by Yasser SolimanKeycloak™ is a trademark of the Linux Foundation. Skycloak is not affiliated with the Keycloak project.