Clean and simplify redirect_uri logic
Exemption for sandboxes, better logging
Further cleanup redirect_uri checks