Redirect URIs
The redirect URI is where SingleSign sends the user after they authenticate. It is a critical security boundary — if an attacker can trick SingleSign into redirecting to a URI they control, they can steal the authorization code and exchange it for tokens.
SingleSign enforces strict rules to prevent this.
How Redirect URIs Work
- You register one or more redirect URIs in the developer portal when creating your app.
- When your app initiates the authorization flow, it includes a
redirect_uriparameter. - SingleSign checks that the
redirect_uriexactly matches one of the registered URIs. - If there's a match, SingleSign redirects the user to that URI with the authorization code.
- If there's no match, the request is rejected with an error.
GET https://api.singlesign.com/oauth/authorize
?platform_guid=YOUR_PLATFORM_GUID
&response_type=code
&client_id=YOUR_CLIENT_ID
&redirect_uri=https://app.example.com/callback ← must match exactly
&scope=openid+profile+email
&state=RANDOM_STATE
&code_challenge=CHALLENGE
&code_challenge_method=S256
Rules
1. HTTPS is Required in Production
All redirect URIs must use the https:// scheme in production. This ensures the authorization code is transmitted over an encrypted channel.
Exception: http://localhost (with any port) is allowed for local development.
✅ https://app.example.com/callback
✅ https://staging.example.com/auth/callback
✅ http://localhost:3000/callback (development only)
✅ http://localhost:8080/auth/callback (development only)
❌ http://app.example.com/callback (not HTTPS)
2. Exact Match — No Wildcards
SingleSign compares the redirect_uri parameter against the registered URIs using exact string matching. There is no wildcard, pattern, or subdomain matching.
Registered: https://app.example.com/callback
✅ https://app.example.com/callback
❌ https://app.example.com/callback/ (trailing slash)
❌ https://app.example.com/callback?foo=bar (query string)
❌ https://APP.example.com/callback (case difference in path)
❌ https://*.example.com/callback (wildcard — not supported)
3. No Query Parameters
The registered URI must not include query parameters. SingleSign will append the code and state parameters to the URI during the redirect.
Registered: https://app.example.com/callback
Redirect will be:
https://app.example.com/callback?code=AUTH_CODE&state=RANDOM_STATE
4. No Fragments
Fragment identifiers (#) are not allowed in redirect URIs.
❌ https://app.example.com/callback#section
5. Custom URI Schemes for Mobile
Mobile and native apps may use custom URI schemes:
✅ com.yourcompany.yourapp://callback
✅ com.yourcompany.yourapp://auth/callback
For production mobile apps, prefer universal links (iOS) or app links (Android) over custom schemes for stronger security. See the Mobile / Native Guide.
Allow-Listing in the Developer Portal
Adding Redirect URIs
- Go to Developer Portal → Applications → (your app) → Settings.
- In the Redirect URIs section, click Add URI.
- Enter the full URI including the scheme, host, port (if non-standard), and path.
- Save.
Multiple Environments
Register a separate redirect URI for each environment:
| Environment | Redirect URI |
|---|---|
| Local development | http://localhost:3000/callback |
| Staging | https://staging.app.example.com/callback |
| Production | https://app.example.com/callback |
Your app selects the appropriate URI at runtime based on the environment.
Common Mistakes
1. Trailing Slash Mismatch
Problem: Registered https://app.example.com/callback but the app sends https://app.example.com/callback/.
Fix: Make sure the registered URI and the redirect_uri parameter are identical, including the presence or absence of a trailing slash.
2. Port Mismatch
Problem: Registered http://localhost:3000/callback but the dev server runs on port 5173.
Fix: Register the URI with the correct port, or register multiple ports.
3. Scheme Mismatch
Problem: Registered https:// but the app sends http:// (or vice versa).
Fix: Always use https:// in production. For localhost, ensure the scheme matches.
4. Path Mismatch
Problem: Registered https://app.example.com/auth/callback but the app sends https://app.example.com/callback.
Fix: The full path must match. Double-check the registered path against your application's route.
5. Forgetting to Register a New Environment
Problem: Deployed to a new staging URL but forgot to add its redirect URI.
Error: redirect_uri_mismatch — "The redirect_uri does not match any registered redirect URIs."
Fix: Add the new URI in the developer portal before deploying.
6. Using Wildcards
Problem: Attempting to register https://*.example.com/callback or https://app.example.com/*.
Fix: Wildcards are not supported. Register each exact URI individually.
Security Rationale
Why Exact Matching?
Open redirect vulnerabilities are one of the most common OAuth attacks. If SingleSign allowed wildcards or partial matching:
https://*.example.com/callbackcould matchhttps://evil.example.com/callback.https://app.example.com/*could matchhttps://app.example.com/attacker-controlled-page.
Exact matching eliminates these attack vectors entirely.
Why HTTPS?
Without HTTPS, the authorization code is sent in cleartext over the network. An attacker on the same network (e.g., public Wi-Fi) could intercept it and exchange it for tokens.
The localhost exception exists because local development traffic never leaves your machine.
Redirect URI Validation Flowchart
Client sends redirect_uri
│
▼
Is redirect_uri registered? ──No──▶ Reject: redirect_uri_mismatch
│
Yes
│
▼
Is it HTTPS or localhost? ──No──▶ Reject: invalid redirect scheme
│
Yes
│
▼
Proceed with authorization flow
Troubleshooting
If you receive a redirect_uri_mismatch error:
- Copy the exact URI from your application's authorization request (check the browser's address bar or network tab).
- Compare it character by character to the URI registered in the developer portal.
- Check for: trailing slashes, scheme differences, port differences, path differences, and URL encoding differences.
- If using a framework that auto-appends a trailing slash, either update the registered URI or configure the framework to not add it.
Next Steps
- Register an App — Configure redirect URIs in the portal.
- SPA with PKCE Guide — See redirect URIs in action.
- Mobile / Native Guide — Custom URI schemes and universal links.
- Troubleshooting — Fix common redirect URI issues.
Last updated: 2026-02-16
Related docs
- SingleSign Developer DocumentationLearn how to integrate SingleSign identity and authentication into your applications using OAuth 2.0 and OpenID Connect.
- Identity provider security, by designIdentity provider security at SingleSign: PKCE-protected code exchange, redirect URI allow-lists, MFA, session and device control, and rate limiting.
- Firebase Auth comparisonSingleSign vs Firebase Authentication on lock-in, portability and consent, plus the cases where staying on Firebase is right.
- Auth0 comparisonSingleSign vs Auth0 compared on the difference that matters: who owns the account. A side-by-side table, then the three cases where each one is the right call.
- SaaS single sign-onSSO for SaaS applications using OAuth 2.0 and OpenID Connect: the flow to pick, the scopes to request, and a working integration path with SingleSign.
- Authentication for startupsAuthentication for startups without a monthly-active-user meter: standards-based OAuth 2.0 sign-in you will not have to replace when the product finds traction.
- React authenticationReact authentication done the recommended way: Authorization Code with PKCE, and no client secret in your JavaScript bundle.
- Mobile app authenticationMobile app authentication for iOS and Android: Authorization Code with PKCE in a system browser, custom scheme redirects, and secure token storage on device.
- Proof Key for Code Exchange (PKCE)Why PKCE exists, how the S256 challenge method works, and when to use it with SingleSign.
- SingleSign pricingSingleSign pricing in one line: sign-in is free, with no monthly-active-user meter. See exactly what is included, and what SingleSign Mail costs for businesses.
- Identity provider alternativesIdentity provider alternatives, by the provider you are leaving: what actually has to change in your code, and what does not.
- Okta comparisonSingleSign vs Okta: Okta is built for workforce identity inside a company, SingleSign for consumer sign-in across applications.