Clean up format-authentication-uri function.