Adding a secured service from the ArcGIS Server REST endpoint returns the error message "The URL you provided is incorrect" in Map Viewer in ArcGIS Online.
This issue is not reproducible after the ArcGIS Online, June 2023 update.
解决办法
Add as an item in ArcGIS Online.
In ArcGIS Online, navigate to the map on the Content tab. On the item details page, click the drop-down arrow and select Open in Map Viewer Classic.
In the Map Viewer Classic view, at the top ribbon, click Add > Add Layer from Web. In the Add Layer from Web dialog box, paste the URL and click ADD LAYER. In the prompt for credentials, key in the credentials and save. Switching to Map Viewer works.