KeyCloak redirects to wrong port when using custom protocol


Backstory: I’m trying to set up authentication with react-native/expo on android but i keep getting redirected back to the wrong port. In order to get android to trigger launch of the expo app I’m using the protocol exp://. I want to be redirected to exp:// but i get redirected to exp://

KeyCloak removes the port from the redirect.
I get a login link that looks like:

I’m expecting to be redirected to exp:// but i keep getting redirected to exp:// If i change the protocol from exp to http it works (given that I add them to Valid Redirect URIs)

I get redirected to something like: exp://–/expo-auth-session?state=RbRhWBBjQg&session_state=93bf4fd9-29fb-438b-8ec1-a5a150ed82ad&code=e46643c8-13f6-4964-b23f-85144735b579.93bf4fd9-29fb-438b-8ec1-a5a150ed82ad.3568fb9b-9dfa-434c-a68d-45fbf711becc
Notice the port missing here!

This can be replicated by adding any redirect with dummy protocol and a port. Try to log in anch check network tab in browser developer tools.

Does anybody have any ideas?

Are you using expo auth session?

Yes. I can get around the problem by using the Expo proxy, but i don’t really want to use the proxy.