Can I give internet acess to the ESP32?

I understand that there's a firmware for that (GitHub - martin-ger/esp32_nat_router: An AI-enabled NAT Router/Firewall for the ESP32 · GitHub), but I'd like to do it in Arduino IDE. Can I give internet acess to the ESP32's AP?

I am not following most of your post, but using an esp32 to access the internet is in the example code provided by the board.

It does not appear to be IDE compatible. It does appear to be Platform IO compatible though, the link you provided has lot's of information including a building link. It is IDF not IDE format.

If you just want internet access via your esp32, there are many sample sketches in the board section of the IDE/File/Examples section. The randomnerdstutorials.com website is also very good.

See this overview:

I ran a Telnet server on an ESP32, opened port 23 on my router and left it connected to the internet for a couple of weeks.

In that time, over 3000 computers around the world connected to it, even though it's sole function was to print C:\ to any client to which it connected.
Two of those even managed to crash it, with continuing attempts to 'get into it'.

Telnet doesn't come with much security.....