IAM glossary
What is Redirect URI?
The address where the identity provider sends the user back with the code. It must be registered exactly, with no wildcards, or codes and tokens can be sent to an attacker.
How it works
The redirect URI is the address where the authorization server sends the user back after login, with the authorization code (or an error). The app registers its exact redirect URIs in advance, and sends one of them in each authorization request.
The server must compare it with the registered list exactly, character by character. If it accepted any URL, an attacker could craft a login link that sends the code to their own site and then exchange it.
A simple example
An app registers https://app.example.com/callback. An attacker sends a victim a login link with redirect_uri=https://app.example.com.evil.io/callback. A server with exact matching refuses it; a server that only checks “starts with app.example.com” would send the victim’s code to the attacker.
Common mistakes
- Wildcards or prefix matching on redirect URIs.
- Leaving
http://localhostredirect URIs from development in production. - Open redirects on the callback page that forward the code elsewhere.