Twitch only supports static Redirect URIs, so a random port would not be suitable for Twitch’s OAuth flows,
Depending on your use case, there are solutions such as using a reverse proxy which can act as your Redirect URI and that forwards the traffic on to whatever internal port you are using. Or you could use a static port.