OAuth Redirect URI Security: Prevent Authentication Flaws

Misconfigured OAuth redirect URIs can expose authentication flows to abuse. Learn how to validate redirect destinations, review integrations and reduce risk.

OAuth redirect URI security is a critical part of protecting modern sign-in and authorisation flows. If an application accepts an unsafe or overly broad redirect destination, an attacker may be able to send authorisation responses to an unintended location. The precise impact depends on the flow, client implementation and other controls, so teams should validate the configuration rather than assume every redirect issue has the same outcome.

For organisations using single sign-on, SaaS integrations or custom identity flows, redirect URI checks should be part of application security testing and ongoing configuration reviews.

What is a redirect URI?

In OAuth, a redirect URI is the destination an authorisation server sends a user agent to after an authorisation step. The client registers permitted redirect URIs so the identity provider can verify where responses may be delivered. The URI is not just a convenience setting: it helps bind the response to the intended application.

Why weak redirect URI validation matters

Risk can arise when an identity provider or client accepts destinations that are broader than necessary. Examples include wildcard patterns, unsafe subdomain assumptions, open redirects on an otherwise trusted domain, or inconsistent validation between environments.

Depending on the implementation, weaknesses can contribute to authorisation-response leakage, phishing, account compromise or abuse of a trusted sign-in journey. These outcomes are not automatic; they depend on factors such as the response type, PKCE use, token handling, browser behaviour and the exact validation rules.

How to review OAuth redirect URI security

1. Inventory registered clients and destinations

Export or review the redirect URI configuration for each identity provider application. Identify production, test and legacy clients, and assign an owner to each registration. Remove entries that are no longer required.

2. Prefer exact matching

Where supported by the protocol and provider, use exact registered redirect URI matching. Avoid broad wildcards and do not rely on string fragments or loose suffix checks. Treat scheme, hostname, port, path and encoding consistently.

3. Review trusted domains for open redirects

A registered URI may point to a legitimate domain that itself offers an open-redirect endpoint. Test whether a user-controlled parameter can forward a browser to an external site. Do this only within an authorised test scope, and verify behaviour without collecting real tokens or credentials.

4. Separate production and non-production

Do not leave development callbacks registered on production clients unless there is a documented requirement. Test environments should use their own client registrations and credentials where practical.

5. Verify the full flow

Test the authorisation flow end to end. Confirm that unregistered destinations are rejected, error handling does not disclose sensitive values, and tokens are not exposed in browser history, referrer data, logs or third-party scripts. Use PKCE for public clients and follow the current security guidance for the OAuth flow in use.

OAuth redirect URI security checklist

  • Maintain an owner and business purpose for every OAuth client.
  • Use exact redirect URI matching where supported.
  • Remove unused, obsolete and unapproved callback URLs.
  • Review subdomains and callback endpoints for open redirects.
  • Keep production and test registrations separate.
  • Use PKCE and secure token-handling practices appropriate to the client.
  • Test negative cases, including unregistered and malformed destinations.
  • Recheck configuration after identity-provider, domain or application changes.

How to prioritise findings

Prioritise a finding by looking at the affected client, the sensitivity of the connected application, whether an attacker can influence the destination, and what data or authorisation response could be exposed. Validate the actual path and evidence before assigning severity. A broad configuration alone is not enough to prove exploitability.

Attack Insights helps organisations identify and validate external security exposure. Explore Attack Insights to learn more about assessing risk across internet-facing assets and applications.

Frequently asked questions

Should OAuth redirect URIs use wildcards?

Avoid wildcard matching where possible. Exact registered destinations reduce ambiguity and make it easier to reason about where authorisation responses may be sent. If a provider supports patterns, document and test the precise matching behaviour.

Is an open redirect always an OAuth vulnerability?

No. The risk depends on whether the redirect can be used in the relevant authorisation flow and what information or authority could be exposed. Validate the complete chain before drawing conclusions.

Does PKCE fix unsafe redirect URI validation?

No single control replaces redirect URI validation. PKCE helps protect authorisation-code flows against code interception, but clients should still register and validate redirect destinations correctly and protect tokens.

How often should redirect URI settings be reviewed?

Review them during application onboarding, identity-provider changes, domain changes, major releases and periodic access reviews. Remove obsolete callback URLs promptly.

What evidence should a security test capture?

Record the client configuration, test case, expected and observed response, affected environment and remediation recommendation. Avoid storing real authorisation codes, tokens or personal data in test evidence.

Sources

Cloud security failures often come from identity, exposure and configuration drift rather than a single software flaw. Use this checklist to review your cloud environment systematically.

AI agents can call tools, access data and take actions on behalf of users. Use these ten controls to limit agent permissions, manage tool risk and monitor autonomous workflows.

Preparing for post-quantum cryptography starts with understanding where cryptography is used. Use these vendor questions to assess dependencies, migration readiness and long-term risk.

External Attack Surface

Discover and monitor every internet-facing asset you own.

Detect new CVEs and exposures as they appear.

Find misconfigurations across AWS, Azure and GCP.

Prove your security controls actually work.

Threat & Digital Risk

Our public threat intelligence platform, in real time.

Spot leaked credentials and targeted threats early.

AI-driven prioritisation that cuts through the noise.

Protect your brand, data and people beyond the perimeter.

API & Email Security

Discover and test externally exposed APIs.

Stop spoofing with SPF, DKIM and DMARC checks.

Dashboards and board-ready security reporting.

Continuously test your public web applications.

Stream validated findings to your SIEM, SOAR and ticketing tools.

Explore

See the full Attack Insights platform.

See Attack Insights in action.