Web Redirect URIs for Azure AD B2C don't work when URI contains combination of subdomain and port.
When using Azure AD B2C to register a SAML\OpenID application, the Redirect URI attribute never seems to match when the URI contains a sub-domain and port number. Individually these work OK. This also doesn't affect regular Entra ID, only Azure AD B2C.
E.g. setting the Redirect URI values below produces the following outcomes:
Redirect URI | Result |
---|---|
https://sub.localhost.com/path/more | OK |
https://localhost.com:443/path/more | OK |
https://sub.localhost.com:443/path/more | Broken |
When broken, the authorize
endpoint always returns:
error_description=AADB2C90006:
The redirect URI 'https://sub.localhost.com:443/path/more' provided in the request is not registered for the client id '<client_id>'.
Furthermore, changing the Redirect URI
to something that works afterwards results in the app always being in a broken state.
Can reproduce sending the following request via Postman:
https://<tenant>.b2clogin.com/<tenant>.onmicrosoft.com/<Policy>/oauth2/v2.0/authorize?client_id=<client_id>&redirect_uri=https%3A%2F%2Fsub.localhost.com%3A443%2Fpath%2Fmore&scope=openid+profile+email&response_type=code&state=345345345&nonce=67546363
This doesn't appear to be listed in the restrictions documentation below so may be a possible bug?
https://learn.microsoft.com/en-us/entra/identity-platform/reply-url