I’ve looked at this some more. It seems that it’s not possible to make an API request to /users/by-external on a private forum. If it was possible to do it without authentication, it would be a security breach. With authentication, you need to know the API key and username of the user you are looking for by the external_id, but if you already have that information, there’s no need to make the request.
For my purpose, what I really need to know is the WordPress user’s Discourse id. The best approach to getting that seems to be to use a Discourse webhook to send the user data to WordPress when the user is created or updated on Discourse. That data can then be stored on WordPress.