better handling for target_type and redirect_uri