Redirect_uri' does not match due to port forwarding?

hi,
I’m using okta sample python flask (hosted log in) (downloaded from application page). The code working fine in my local and on prem server (i used port 8503). But once I deployed to cloud with port forwarding from 80 → 8503. the /authorization-code/callback end point keep showing error:

{‘error’: ‘invalid_grant’, ‘error_description’: “The ‘redirect_uri’ does not match the redirection URI used in the authorization request.”}

Any suggestion is much appreciated.

Thanks

@thanhtam Please check if you pass the URI correctly. Here is the solution for the similar issue.

hi @Lija, Thanks for the response, I have passed the redirect_url as parameter in my request.

I have found the rootcaused. Just post here if anyone having same issue.

My application is running behind a load balancer, and https request was forwarded as http (s was removed). Once my application send verification request to okta, I get url mismatched error because ‘https:…’ != ‘http://…’

A work around to change http to https internally fixed my issue.

Thanks