ESP32 Not Connecting to wifi

I have multiple esp devices, and never had a problem with them connecting to wifi. But now i took an old esp32-wroom-32 and flashed it with a new config but it keeps getting stuck in connecting to wifi. It finds the network but keeps getting stuck on ‘auth expired’

[18:16:22]ets Jul 29 2019 12:21:46
[18:16:22]
[18:16:22]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[18:16:22]configsip: 0, SPIWP:0xee
[18:16:22]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[18:16:22]mode:DIO, clock div:2
[18:16:22]load:0x3fff0030,len:1184
[18:16:22]load:0x40078000,len:13132
[18:16:22]load:0x40080400,len:3036
[18:16:22]entry 0x400805e4
[18:16:22][I][logger:156]: Log initialized
[18:16:22][C][safe_mode:079]: There have been 0 suspected unsuccessful boot attempts
[18:16:22][D][esp32.preferences:114]: Saving 1 preferences to flash...
[18:16:22][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[18:16:22][I][app:029]: Running through setup()...
[18:16:22][C][wifi:048]: Setting up WiFi...
[18:16:22][C][wifi:061]: Starting WiFi...
[18:16:22][C][wifi:062]:   Local MAC: 08:D1:F9:CD:2F:F0
[18:16:22][D][wifi:482]: Starting scan...
[18:16:22][W][component:157]: Component wifi set Warning flag: scanning for networks
[18:16:26][D][wifi:497]: Found networks:
[18:16:26][I][wifi:541]: - 'DavinciITOper' (8A:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:16:26][D][wifi:542]:     Channel: 1
[18:16:26][D][wifi:543]:     RSSI: -73 dB
[18:16:26][I][wifi:541]: - 'DavinciITOper' (D2:32:E5:07:DE:12) [redacted]▂▄▆█
[18:16:26][D][wifi:542]:     Channel: 11
[18:16:26][D][wifi:543]:     RSSI: -83 dB
[18:16:26][I][wifi:541]: - 'DavinciITOper' (DE:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:16:26][D][wifi:542]:     Channel: 6
[18:16:26][D][wifi:543]:     RSSI: -90 dB
[18:16:26][D][wifi:546]: - 'ShellyPlus1PM-E465B892DDC0'[redacted] (E4:65:B8:92:DD:C1) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'SMA3010294398'[redacted] (F8:33:31:EC:5E:BB) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'Aquasense'[redacted] (84:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'MusicAqua'[redacted] (8E:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'VOIP'[redacted] (92:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'Aquasense'[redacted] (CC:32:E5:07:DE:12) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'MusicAqua'[redacted] (D6:32:E5:07:DE:12) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'VOIP'[redacted] (DA:32:E5:07:DE:12) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'MusicAqua'[redacted] (E2:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'VOIP'[redacted] (E6:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'Aquasense'[redacted] (D8:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'TP-Link_D9C4'[redacted] (28:87:BA:53:D9:C4) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'speedy'[redacted] (24:05:88:18:B6:E0) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'telenet-2AB55'[redacted] (34:2C:C4:A7:CF:D7) [redacted]▂▄▆█
[18:16:26][D][wifi:546]: - 'WiFi-2.4-493E'[redacted] (00:37:B7:74:49:44) [redacted]▂▄▆█
[18:16:26][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:16:38][W][wifi:669]: Connecting to WiFi network failed. Are the credentials wrong?
[18:16:38][W][wifi_esp32:532][arduino_events]: Event: Disconnected ssid='DavinciITOper' bssid=8A:D8:1B:DC:FB:C0[redacted] reason='Handshake Failed'
[18:16:38][D][wifi:697]: Retrying with hidden networks...
[18:16:43]                                                                m[I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:16:43][W][wifi:669]: Connecting to WiFi network failed. Are the credentials wrong?
[18:16:43][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:16:43][W][wifi:669]: Connecting to WiFi network failed. Are the credentials wrong?
[18:16:45][W][wifi_esp32:532][arduino_events]: Event: Disconnected ssid='DavinciITOper' bssid=8A:D8:1B:DC:FB:C0[redacted] reason='Authentication Failed'
[18:16:48][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:16:48][W][wifi:669]: Connecting to WiFi network failed. Are the credentials wrong?
[18:16:48][D][wifi:697]: Retrying with hidden networks...
[18:16:48][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:16:48][W][wifi:669]: Connecting to WiFi network failed. Are the credentials wrong?
[18:16:48][D][wifi:697]: Retrying with hidden networks...
[18:16:53][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:16:53][W][wifi_esp32:532][arduino_events]: Event: Disconnected ssid='DavinciITOper' bssid=8A:D8:1B:DC:FB:C0[redacted] reason='Association Leave'
[18:16:53][W][wifi:674]: WiFi Unknown connection status 0
[18:16:53][W][wifi:690]: Restarting WiFi adapter...
[18:16:53][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:16:55][W][wifi_esp32:532][arduino_events]: Event: Disconnected ssid='DavinciITOper' bssid=8A:D8:1B:DC:FB:C0[redacted] reason='Authentication Failed'
[18:17:00][D][wifi:482]: Starting scan...
[18:17:06][D][wifi:497]: Found networks:
[18:17:06][I][wifi:541]: - 'DavinciITOper' (D2:32:E5:07:DE:12) [redacted]▂▄▆█
[18:17:06][D][wifi:542]:     Channel: 11
[18:17:06][D][wifi:543]:     RSSI: -85 dB
[18:17:06][I][wifi:541]: - 'DavinciITOper' (DE:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:17:06][D][wifi:542]:     Channel: 6
[18:17:06][D][wifi:543]:     RSSI: -93 dB
[18:17:06][I][wifi:541]: - 'DavinciITOper' (8A:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:17:06][D][wifi:542]:     Channel: 1
[18:17:06][D][wifi:543]:     RSSI: -76 dB
[18:17:06][D][wifi:546]: - 'ShellyPlus1PM-E465B892DDC0'[redacted] (E4:65:B8:92:DD:C1) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'SMA3010294398'[redacted] (F8:33:31:EC:5E:BB) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'Aquasense'[redacted] (84:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'MusicAqua'[redacted] (8E:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'VOIP'[redacted] (92:D8:1B:DC:FB:C0) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'VOIP'[redacted] (DA:32:E5:07:DE:12) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'MusicAqua'[redacted] (D6:32:E5:07:DE:12) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'Aquasense'[redacted] (CC:32:E5:07:DE:12) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'MusicAqua'[redacted] (E2:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'VOIP'[redacted] (E6:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'Aquasense'[redacted] (D8:47:32:7E:4C:7A) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'TP-Link_D9C4'[redacted] (28:87:BA:53:D9:C4) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'Proximus-Home-F510'[redacted] (A8:6A:BB:7D:F5:16) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'telenet-2AB55'[redacted] (34:2C:C4:A7:CF:D7) [redacted]▂▄▆█
[18:17:06][D][wifi:546]: - 'speedy'[redacted] (24:05:88:18:B6:E0) [redacted]▂▄▆█
[18:17:06][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:17:06][W][wifi:669]: Connecting to WiFi network failed. Are the credentials wrong?
[18:17:06][I][wifi:313]: WiFi Connecting to 'DavinciITOper'...
[18:17:06][W][wifi:669]: Connecting to WiFi network failed. Are the credentials wrong?
[18:17:09][W][wifi_esp32:532][arduino_events]: Event: Disconnected ssid='DavinciITOper' bssid=D2:32:E5:07:DE:12[redacted] reason='Auth Expired'

I tried all the parameters that i could add under wifi (output_power, power_save_mode, …) and it didnt solve it.

I am using the normal empty config, ssid and password are correct:

esphome:
  name: "board"
  friendly_name: "board"

esp32:
  board: az-delivery-devkit-v4
  framework:
    type: arduino

# Enable logging
logger:

substitutions:
  name: "board"
# Enable Home Assistant API
api:
  encryption:
    key: "hj1XVoBeAFhZZbDJQA8k/wouNjB3noJTg6k08xayrx8="

ota:
  - platform: esphome
    password: "4470a33a055a2391397a2f3e92eeef9e"

wifi:
  # fast_connect: on
  # power_save_mode: none
  # enable_on_boot: True
  # output_power: 8.5
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "board Fallback Hotspot"
    password: "I6xo79EYMmXe"

captive_portal:

Are you sure you didnt use this device previously in Esphome and didnt delete it and its expecting a different encryption code?

I have used this device before, and deleted it. But corret me if i am wrong but the encryption key of esphome has nothing to do with it’s ability to connect to wifi right?

I believe you are correct. Recently I flashed an esp i had used previously in esphome and got that message auth expired until I deleted it from esphome.
Try settings a fixed ip address.