Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Sign-in never returns to the app

When a provider will not accept an application's return address, it refuses the sign-in on its own page and sends nothing back, so the application's logs stay empty. This lesson follows the printing site's customers stuck at the photo service, compares the two addresses character by character, and repairs the registration without loosening the comparison.

Users are stuck at the provider

All names, domains and identifiers in these examples are fictional. You are on the printing company's web team. Its site, printer.example, lets customers sign in with their photo service account so they can print straight from their albums. On Thursday afternoon the support queue fills with the same complaint. Mara writes: "I click Sign in with Photos and land on a page at the photo service that says We can't send you back to this application. There's a reference number at the bottom. I tried three times."

Your first instinct is to open the site's own logs, and they are strangely quiet. No callback errors, no failed token exchanges, nothing for Mara at all. What the site does record is every sign-in it starts, because it builds the authorization request before sending the browser to the provider:

window          auth.start   callback.received   token.exchange
13:30-13:45     398          391                 391
13:45-14:00     412          57                  57
14:00-14:15     436          0                   0

Attempts start at the usual rate, and since about 13:53 none of them come back. Here is one of those requests, as the site logged it, with the per-attempt values redacted. Its parameters are the ones The authorization request described, including the redirect_uri the photo service should send Mara back to:

https://auth.photos.example/authorize
  ?response_type=code
  &client_id=printer-web
  &redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback
  &scope=openid%20photos.read
  &state=<redacted>
  &code_challenge=<redacted>
  &code_challenge_method=S256

Mara's reference number is the photo service's request ID for the page she saw. It identifies one request and grants nothing, so it is fine to have in a ticket. Ask her for that and the time she tried, not for a screenshot of her address bar.

Why the app's logs are empty

Fetch the same authorization URL yourself and look at the raw response:

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=utf-8
Cache-Control: no-store
X-Request-ID: 3f9a6c21-0d84-4e7b-b915-6a2e8c47d0f3

<!doctype html>
<title>Sign-in problem</title>
<h1>We can't send you back to this application</h1>
<p>The return address in this request is not registered for this application.</p>
<p>Reference: 3f9a6c21-0d84-4e7b-b915-6a2e8c47d0f3</p>

The important part is what is missing. There is no Location header, so the browser is not redirected anywhere. Most authorization errors do travel back to the application, as a redirect to its callback such as https://printer.example/oauth/callback?error=access_denied&state=... when a user declines, as Errors and denied access showed. This one cannot. RFC 6749 says that when the redirect URI is missing, invalid or does not match, the authorization server should tell the user about the error and must not redirect the browser to that address. The provider has no reason to trust an address it cannot match to the registration, and it will not send a code there, or even an error. It shows its own page instead.

That is why the site's logs are empty. The failure happened entirely at the provider, before anything returned, so the evidence lives in the provider's records. A counter of started attempts against callbacks received, like the one above, is the quickest way to notice this pattern from the application's side.

If you run the provider, or can ask its support team, the request ID leads to its audit record:

time        2026-10-15T14:06:41.208Z
operation   oauth.authorize
outcome     rejected
reason      redirect_uri_mismatch
client      printer-web
requested   https://printer.example/oauth/callback
registered  https://printer.example/oauth/callback/
request_id  3f9a6c21-0d84-4e7b-b915-6a2e8c47d0f3

The record holds both values the provider compared, which is exactly what the next step needs.

Compare the complete addresses

Put the two values one above the other and read every character:

requested   https://printer.example/oauth/callback
registered  https://printer.example/oauth/callback/

One trailing slash. Your web router sends both paths to the same handler, so to a developer they look like the same page. To the provider they are two different strings, and strings are what it compares. RFC 6749 asks the server to compare a fully registered redirect URI with simple string comparison, and the OAuth security best current practice, RFC 9700, requires exact string matching, for the reasons Redirect URI validation walked through. Its one exception belongs to native apps: under RFC 8252, an app that receives the response on a loopback IP address such as http://127.0.0.1:51004/callback may use any port, because the operating system picks a free one at run time, as Redirect URIs and client metadata explained. Everything else in that address must still match.

A trailing slash is one of a handful of near misses that cause most of these incidents. Each row below is a registered address and a requested one that a person would read as the same page:

Common redirect URI near misses
RegisteredRequestedWhat differs
https://printer.example/oauth/callbackhttps://printer.example/oauth/callback/Trailing slash
https://printer.example/oauth/callbackhttp://printer.example/oauth/callbackScheme, often from an app behind a proxy that terminates HTTPS
http://127.0.0.1:8080/callbackhttp://localhost:8080/callbackHost: a name and an IP address are different strings
https://printer.example/oauth/callbackhttps://printer.example:8443/oauth/callbackPort
https://printer.example/oauth/callbackhttps://printer.example/OAuth/CallbackPath, including capital letters
https://printer.example/oauth/callbackhttps://staging.printer.example/oauth/callbackA staging address sent with the production client ID

The requested value matches what the site has always sent, so the registration is the side that moved. The client's change history at the provider confirms it. At 13:52 your teammate Mateo updated the printer-web registration to refresh its logo and description, and while he was there he retyped the callback with a trailing slash to match the style of other addresses in the console. The first refused request in the provider's records is at 13:53:06.

The second comparison, at the token endpoint

Before anyone found Mateo's change, another teammate tried a quick fix. Ingrid saw the registered value in the console and changed the site's login service to send the trailing-slash address, so that the authorization request would match. It did: sign-ins started reaching the callback again. Then every one of them failed one step later, at the token exchange:

POST /token HTTP/1.1
Host: auth.photos.example
Authorization: Basic <redacted>
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=<redacted>&redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback&code_verifier=<redacted>

HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-store

{"error": "invalid_grant",
 "error_description": "redirect_uri does not match the value used in the authorization request"}

The site's code redemption runs in a separate session service with its own configuration, and nobody changed that one. When the provider issues a code, it remembers the redirect URI the authorization request used. RFC 6749 requires the token request to include redirect_uri when the authorization request did, with an identical value, and refuses a mismatch as invalid_grant, as Exchanging a code for tokens described. Fixing one comparison while leaving the other alone moved the failure from the authorization endpoint to the token endpoint. A new error after a change like that is progress, because it shows exactly which component still holds the old value.

The two redirect URI comparisons in Mara's sign-in, and what each one does with a near miss.

The OAuth 2.1 draft, described in How the specifications evolve, drops redirect_uri from the token request, because PKCE already ties the code to the client that started the flow. Many servers still compare it whenever a client sends it, though, so a client that sends it must send the same value both times.

Whether a refused redemption used up the code depends on the server. Some leave the code redeemable until it expires. Others revoke it after any failed attempt. Either way, don't try to rescue codes from broken attempts. Users start a fresh sign-in once the fault is fixed.

Repair with the exact address

Two values now disagreed in two places, and the repair starts by deciding which address is right. The site's documentation, its session service and its staging client all use /oauth/callback without a slash, and Mateo's edit was cosmetic. So the registration goes back to exactly https://printer.example/oauth/callback, and Ingrid's change to the login service is reverted, so both components send that same value again.

Registering both addresses would also have made the errors stop. During a planned move between two addresses the site owns, listing both for a short time is reasonable, and the old one comes off when the move is finished. Here a second address would only be one more destination nobody needs. A wildcard or a prefix such as https://printer.example/* is never the repair: it lets the provider send codes to any page under that address, including ones that can leak them.

Then verify in both directions. Sign in through the site with a test account in a fresh browser session: the callback receives a code with a matching state, and the token exchange returns 200. Mara tries again and reaches her albums. Then repeat a request that must still be refused, the trailing-slash version of the authorization request:

GET /authorize?response_type=code&client_id=printer-web&redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback%2F&... HTTP/1.1
Host: auth.photos.example

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=utf-8
X-Request-ID: c17d2e90-6b35-4f8a-8e14-0a9f5b3d72c6

A 400 with no Location header, exactly as before, now for the address that is not registered. A repair that made both versions work would have fixed the symptom by loosening the comparison that keeps codes away from addresses nobody checked.

Worked example: the handoff note

The note records the interim change as well as the repair, because the next engineer will find Ingrid's edit in the history and needs to know it was tried and reverted:

Symptom:       From 13:53 UTC, customers stopped at a photo service error page after
               choosing Sign in with Photos. No callbacks reached printer.example.
Failing stage: Authorization request. Provider returned 400 with no Location header,
               audit reason redirect_uri_mismatch (request 3f9a6c21-0d84-4e7b-b915-6a2e8c47d0f3).
Cause:         Registration edit at 13:52 changed the printer-web redirect URI to
               https://printer.example/oauth/callback/ (trailing slash). The site sends
               https://printer.example/oauth/callback.
Interim:       Login service briefly sent the slash version. Authorization succeeded,
               token exchange failed with invalid_grant (session service unchanged).
               Reverted.
Repair:        Registration restored to https://printer.example/oauth/callback exactly.
               Both login and session services send that value.
Verification:  Fresh test sign-in: callback received, token exchange 200. Customer confirmed.
               Trailing-slash request: still 400, no Location (request c17d2e90-6b35-4f8a-8e14-0a9f5b3d72c6).
Not changed:   Client credential, scopes, other registered addresses.

The verification line names the request ID of the refused near miss, so anyone can look up that the strict comparison was checked, not assumed.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Users report an error page at the provider right after choosing Sign in. Your app's callback logs show no requests at all for those attempts. What best explains the empty logs? 1 of 2

Choose one answer.

A developer changes the authorization request to send the trailing-slash callback that is now registered. Sign-ins reach the callback again, but the token request fails with invalid_grant. What is the likeliest cause? 2 of 2

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity