We're using the API explicit flow for identity brokering in our Keycloak SSO server to provide users with the option for logging in using their Stack Overflow account.

Recently, we've noticed that Stack Exchange API seemingly started to ignore the port number specified in the redirect_uri parameter. E.g., when Keycloak is running on 8080 port, user is redirected back to port 80 (or 443 respectively if HTTPS was used) after logging in to Stack Exchange.

In other words, Stack Exchange is ignoring port number and is using the one based on current protocol leading to an error if Keycloak is running on a port which is non-default for given protocol.

After investigating this we were unable to find anything wrong on Keycloak's side. For that reason I'd like to ask if anything changed in the API regarding the ports in redirect URIs, or if it's an issue and an unexpected behavior. If so, is there any way to officially report it?

  • As far as I can tell, none of us has ever gotten nonstandard ports to work. Related posts on Stack Apps start with: stackapps.com/questions/4596/…. Commented Mar 21, 2018 at 19:36
  • A bug report here is the way to report it. But if your company has a business relationship with Stack Exchange you may have additional options. You can also try the contact form, linked at the bottom of this page. Commented Mar 21, 2018 at 19:41
  • Well, the nonstandard ports were working for us from the beginning. But then something broke.
    – vasam
    Commented Mar 23, 2018 at 9:23
  • Vasam, good to know. But define "beginning". When did you start using the API with non-standard ports? Commented Mar 23, 2018 at 16:26
  • Sorry, by the beginning I meant cca March 2015.
    – vasam
    Commented Mar 24, 2018 at 10:02
  • Thanks. I know I tested the problem extensively in 2014, and others have reported it a few times since. Good that it's working now. Commented Mar 24, 2018 at 17:54

1 Answer 1


As of the last build, ports in return redirect_uris should be preserved.

In some cases the port will be stripped, but that should only happen if the port matches the default for the protocol.

  • Thank you very much for the quick fix! I can confirm the issue was resolved and ports are now working as expected.
    – vasam
    Commented Mar 23, 2018 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .