Client type other is for installed applications it should not have a redirect uri the way it works is it returns the authorization code directly back where it came from that being
For some reason your code is sending a https redirect uri which is in correct it should not be doing this. It looks like you are using the code for a web browser application with a native application client.