Redirect URIs
Where Hub sends users after verification, and the rules your URLs must follow.
A redirect URI is the URL Hub sends the user back to when verification finishes. You register them during onboarding.
Rules Hub enforces
Break one of these and your URI is rejected at registration, or the request fails.
| Rule | Detail |
|---|---|
| Must be registered | Hub only redirects to URIs registered for your client |
Must use https | The one exception is http://localhost for local development |
| No fragments | Anything containing # is rejected outright |
| No custom schemes | myapp://callback and com.example.app://cb are rejected. See Mobile apps. |
| Matching is exact | Scheme, host, port, path and trailing slash all count |
Exact means exact.https://acme-widgets.example.com/cbandhttps://acme-widgets.example.com/cb/are different URIs. Register the one your application actually uses.
Fragments
The fragment is the # and everything after it. It's banned by the OAuth spec because fragments never reach your server — the browser keeps them.
❌ https://acme-widgets.example.com/callback#/verify
✅ https://acme-widgets.example.com/callback
This catches out single-page apps that use hash routing. Register the plain URL and let your router handle the #/verify part after the redirect lands.
Blocked by our infrastructure
Some URIs pass Hub's checks but are blocked before the request reaches us.
Don't use an IP address as the host. Use a hostname.
❌ https://192.0.2.10/callback
❌ https://127.0.0.1/callback
✅ https://acme-widgets.example.com/callback
✅ http://localhost:3000/callback
This failure looks nothing like a Hub error. Our web application firewall rejects the request at the edge, so you get a plain HTML403 Forbiddenpage with aServer: awselb/2.0header — not the JSON error Hub normally returns. If you see that, check yourredirect_uribefore anything else.
localhost is fine for local development. 127.0.0.1 is not, even though it means the same thing.
Recommended, not required
These aren't enforced, but following them avoids trouble.
Include a path. https://acme-widgets.example.com works, but https://acme-widgets.example.com/callback is clearer and easier to route.
Keep query parameters to one, or use none. Hub appends code, state and scope to whatever you registered. We've seen a case where extra parameters didn't survive the redirect, so don't depend on more than one.
✅ https://acme-widgets.example.com/callback
✅ https://acme-widgets.example.com/callback?source=verify
⚠️ https://acme-widgets.example.com/callback?source=verify&locale=en
If you need to carry more context, put it in state and store the rest server-side. That's what state is for.
Don't rely on the order of query parameters in the URL you receive. Hub re-encodes the query string, so the order may differ from what you registered.
Registering more than one
You can register several. Common reasons:
- Different user journeys within the same use case
- A local development URL alongside a hosted one
- Separate English and French landing pages
Register every URI you intend to use. You can't add one at request time. Preprod and production are registered separately.
Which URI the user comes back to
The user comes back to the redirect_uri you send when you start the verification in Step 2. You choose it on every request; Hub doesn't pick one from your registered list.
You send: redirect_uri=https://acme-widgets.example.com/callback
The user returns: https://acme-widgets.example.com/callback?code=...&state=...
- It's the same URI whatever the outcome. A successful verification returns a
code; a failed or cancelled one returnserroranderror_description. Both include yourstate. - It must match one of your registered URIs exactly. If it doesn't, Hub can't safely send the user to you and shows its own error page instead, so nothing reaches your callback.
- With several registered URIs, pick per request. For example, send
https://acme-widgets.example.com/fr/callbackfor French-speaking users.
Want the user back on a specific page? Save where they were against yourstatevalue before sending them to Hub. When they arrive at your callback, look upstateand redirect them there. This keeps your redirect URI simple and avoids extra query parameters.
Using it
The redirect_uri appears in three places, and they must all match:
Include it in all three. If you include it in the signed request object it must be identical to the one in the query string — Hub rejects a request that sends two different values:
error=invalid_request
error_description=Discrepancy between 'redirect_uri' from JWT:
'https://acme-widgets.example.com/other' and URL query:
'https://acme-widgets.example.com/callback'
A mismatch at Step 4 produces invalid_grant instead. If you see invalid_grant, check that your redirect_uri matches.
What arrives
On success:
https://acme-widgets.example.com/callback
?code=5GT81abUDETEOpVegWBZ78Aejq...
&scope=openid+onlyVme_scope
&state=5de789881cc944a78e9c1c9d947f7867
On failure:
https://acme-widgets.example.com/callback
?error=access_denied
&error_description=User+cancelled
&state=5de789881cc944a78e9c1c9d947f7867
See Step 3 — Handling the redirect.
Mobile apps
There is no Hub mobile SDK. Native apps integrate with the same OAuth 2.0 / OIDC API as web applications.
Because custom schemes like myapp://callback can't be registered, use an https URL that your app claims — an App Link on Android, a Universal Link on iOS. The operating system intercepts the URL and hands it to your app. Hub doesn't need to know any of this; to Hub it's an ordinary https redirect URI.
How to set it up
- Register a normal https redirect URI, such as
https://acme-widgets.example.com/app/callback. - Publish the association file on that domain so the OS knows your app owns the URL:
- Android —
/.well-known/assetlinks.json - iOS —
/.well-known/apple-app-site-association
- Android —
- Open Hub in a system browser component, not a plain WebView:
- Android — Custom Tabs
- iOS —
ASWebAuthenticationSession
- Serve a real web page at that URL as a fallback, for users who don't have your app installed or whose OS didn't route the link.
Don't use an embedded WebView. Bank sign-in pages frequently block them, and it's discouraged for native apps by RFC 8252. Custom Tabs andASWebAuthenticationSessionexist for exactly this purpose.
App Links and Universal Links are also more secure than custom schemes. Any app can claimmyapp://, but only the verified owner of a domain can claim its https URLs.
Step 4 still happens on your server
Your app receives the code, but the token exchange is signed with your private key. Keep that key on your backend — never in the app. Send the code to your server and let it call the token endpoint.
Security
Your callback endpoint receives an authorization code in a query string, so treat it carefully.
Always use HTTPS in production. http is for local development only.
Check state before anything else. It's how you know the response belongs to the user in front of you. See Step 3.
Keep the path unguessable if it isn't authenticated. The code is single-use and short-lived, but the endpoint is still a public entry point.
Don't put anything sensitive in the URI. It's visible in browser history, referrer headers and server logs. Use state to carry a session reference, and keep the data itself server-side.
Common mistakes
| Problem | Cause |
|---|---|
Plain HTML 403 Forbidden, Server: awselb/2.0 | The URI uses an IP address. Our firewall blocked it before it reached Hub. |
| Nothing arrives at your callback | URI not registered, so Hub shows the user an error page instead |
invalid_request, "Discrepancy between redirect_uri..." | The request object and the query string disagree |
invalid_grant at the token step | The URI at Step 4 doesn't match Step 2 byte for byte |
| Rejected at registration | Contains a # fragment, or uses a custom scheme like myapp:// |
| Works locally, fails deployed | The deployed URI wasn't registered |
| Works in preprod, fails in production | Registration is per environment |
Next
Updated 5 days ago