ESPHome - Wifi - Auth Expired

Same issue here.

Right away when i flash the esp32 it works but after I disconnect it and connect it to the same PC it gives me the auth expired error.

[W][wifi_esp32:640]: Event: Disconnected ssid='TCH 2.4GHZ' bssid=[redacted] reason='Auth Expired'
[W][wifi:591]: Error while connecting to network.
[W][wifi:627]: Restarting WiFi adapter...
[D][esp-idf:000]: I (344622) wifi:
[D][esp-idf:000]: mode : softAP (48:e7:29:97:11:81)
[D][esp-idf:000]: 

[I][wifi:277]: WiFi Connecting to 'TCH 2.4GHZ'...
[D][esp-idf:000]: I (344733) wifi:
[D][esp-idf:000]: mode : sta (48:e7:29:97:11:80) + softAP (48:e7:29:97:11:81)
[D][esp-idf:000]: 

[D][esp-idf:000]: I (344734) wifi:
[D][esp-idf:000]: enable tsf
[D][esp-idf:000]: 

[D][esp-idf:000]: I (344750) wifi:
[D][esp-idf:000]: Set ps type: 1

[D][esp-idf:000]: 

[D][esp-idf:000]: I (344826) wifi:
[D][esp-idf:000]: new:<1,1>, old:<1,0>, ap:<1,1>, sta:<1,0>, prof:1
[D][esp-idf:000]: 

[D][esp-idf:000]: I (344829) wifi:
[D][esp-idf:000]: state: init -> auth (b0)
[D][esp-idf:000]: 

I am having the same issue, It is purely wifi code, I have nothing attached to the Esp32-S2-mini
Here is the code, and it is getting run.

esphome:
  name: s2-mini
  friendly_name: s2-mini
  
esp32:
  board: lolin_s2_mini
  variant: ESP32S2
  framework:
    type: arduino
    version: 2.0.6
    platform_version: 5.4.0

status_led:
  pin: 15

# Enable logging
logger:
  level: debug
wifi:
  ssid: Sweet_Spot_IoT
  password: *redacted*
  power_save_mode: none
  enable_on_boot: True
  fast_connect: On
  output_power: 8.5

this is the output on the serial after the restart

[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...

I also have the ability to scan the ring buffer on my APs for the client itself and any probes its making, and the MAC that is showing when I erase the chip using esptool is either not the mac it uses in the airspace, or my APs aren’t hearing a packet come out of it. This is looking like a driver issue or something at a much lower level than configuration.

If I remove the fast connect, it seems to do a passive scan (listening only) but we get more info reason=‘Auth Expired’

[W][wifi:640]: Restarting WiFi adapter...
[D][wifi:441]: Starting scan...
[D][wifi:456]: Found networks:
[I][wifi:500]: - 'Sweet_Spot_IoT' (88:B1:E1:2D:12:F2) ▂▄▆█
[D][wifi:501]:     Channel: 1
[D][wifi:502]:     RSSI: -72 dB
[I][wifi:500]: - 'Sweet_Spot_IoT' (30:86:2D:B0:70:91) ▂▄▆█
[D][wifi:501]:     Channel: 1
[D][wifi:502]:     RSSI: -57 dB
[D][wifi:505]: - 'Sweet Spot' (30:86:2D:B0:70:90) ▂▄▆█
[D][wifi:505]: - 'I'm a rogue 2' (00:14:6C:C6:BE:F1) ▂▄▆█
[D][wifi:505]: - 'Rogue AP' (00:14:6C:C6:BE:F0) ▂▄▆█
[D][wifi:505]: - 'Sweet Spot' (88:B1:E1:2C:00:10) ▂▄▆█
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:2D:12:F2 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[D][wifi:441]: Starting scan...
[D][wifi:456]: Found networks:
[I][wifi:500]: - 'Sweet_Spot_IoT' (88:B1:E1:29:EB:61) ▂▄▆█
[D][wifi:501]:     Channel: 6
[D][wifi:502]:     RSSI: -53 dB
[I][wifi:500]: - 'Sweet_Spot_IoT' (30:86:2D:B0:70:91) ▂▄▆█
[D][wifi:501]:     Channel: 1
[D][wifi:502]:     RSSI: -56 dB
[D][wifi:505]: - 'Sweet Spot' (88:B1:E1:29:EB:60) ▂▄▆█
[D][wifi:505]: - 'Sweet Spot' (30:86:2D:B0:70:90) ▂▄▆█
[D][wifi:505]: - 'I'm a rogue 2' (00:14:6C:C6:BE:F1) ▂▄▆█
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:29:EB:61 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'Sweet_Spot_IoT'...
[W][wifi_esp32:458]: Event: Disconnected ssid='Sweet_Spot_IoT' bssid=88:B1:E1:29:EB:61 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...

I even tried an ancient (2006) Netgear 802.11g AP. Single SSID basic WPA2 PSK all the same error, and I can’t see anything coming out of the chip in airspace at all. no probes or anything. Something is broken in this things 802.11 it seems. I have also powered it using my benchtop power supply at 3.45v with 10a available on the 3.3v pins. So power is not the issue.

[I][wifi:500]: - 'I'm a rogue 2' (00:14:6C:C6:BE:F1) ▂▄▆█
[D][wifi:501]:     Channel: 11
[D][wifi:502]:     RSSI: -79 dB
[D][wifi:505]: - 'Sweet_Spot_IoT' (88:B1:E1:29:EB:61) ▂▄▆█
[D][wifi:505]: - 'Sweet Spot' (30:86:2D:B0:70:90) ▂▄▆█
[D][wifi:505]: - 'Sweet_Spot_IoT' (30:86:2D:B0:70:91) ▂▄▆█
[D][wifi:505]: - 'Sweet Spot' (88:B1:E1:29:EB:60) ▂▄▆█
[D][wifi:505]: - 'Sweet_Spot_IoT' (88:B1:E1:2D:12:F2) ▂▄▆█
[D][wifi:505]: - 'Rogue AP' (00:14:6C:C6:BE:F0) ▂▄▆█
[D][wifi:505]: - 'Rogue'n around' (00:14:6C:C6:BE:F2) ▂▄▆█
[I][wifi:286]: WiFi Connecting to 'I'm a rogue 2'...
[W][wifi_esp32:458]: Event: Disconnected ssid='I'm a rogue 2' bssid=00:14:6C:C6:BE:F1 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'I'm a rogue 2'...
[W][wifi_esp32:458]: Event: Disconnected ssid='I'm a rogue 2' bssid=00:14:6C:C6:BE:F1 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[D][wifi:441]: Starting scan...
[D][wifi:456]: Found networks:
[I][wifi:500]: - 'I'm a rogue 2' (00:14:6C:C6:BE:F1) ▂▄▆█
[D][wifi:501]:     Channel: 11
[D][wifi:502]:     RSSI: -78 dB
[D][wifi:505]: - 'Sweet Spot' (88:B1:E1:29:EB:60) ▂▄▆█
[D][wifi:505]: - 'Sweet_Spot_IoT' (88:B1:E1:29:EB:61) ▂▄▆█
[D][wifi:505]: - 'Sweet Spot' (30:86:2D:B0:70:90) ▂▄▆█
[D][wifi:505]: - 'Sweet_Spot_IoT' (30:86:2D:B0:70:91) ▂▄▆█
[D][wifi:505]: - 'Sweet_Spot_IoT' (88:B1:E1:2D:12:F2) ▂▄▆█
[D][wifi:505]: - 'Rogue AP' (00:14:6C:C6:BE:F0) ▂▄▆█
[D][wifi:505]: - 'Rogue'n around' (00:14:6C:C6:BE:F2) ▂▄▆█
[I][wifi:286]: WiFi Connecting to 'I'm a rogue 2'...
[W][wifi_esp32:458]: Event: Disconnected ssid='I'm a rogue 2' bssid=00:14:6C:C6:BE:F1 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...
[I][wifi:286]: WiFi Connecting to 'I'm a rogue 2'...
[W][wifi_esp32:458]: Event: Disconnected ssid='I'm a rogue 2' bssid=00:14:6C:C6:BE:F1 reason='Auth Expired'
[W][wifi:604]: Error while connecting to network.
[W][wifi:640]: Restarting WiFi adapter...

Same problem here, with a esp32-wroom-32U.

I’ve came across the same problem when coding my ESP32 base libraries ( see here : GitHub - aeonSolutions/aeonlabs-ESP32-C-Base-Firmware-Libraries: ESP32 C++ Base Firmware Libraries )

You have to add this code after running WiFi.softAP or WiFi.begin for the Wifi to work.

WiFi.setTxPower(WIFI_POWER_8_5dBm); 

More information about this can be found here: Get started with Arduino [C3 series] — WEMOS documentation

Having 2 similar D1 mini ESP32s here. One works like a charm (less ble_tracker issues), the other cannot connect to wifi. Same config uploaded via USB.
Extra 1000uF on the 3.3V did not help. Nothing attached.

wifi:
  ssid: Sweet_Spot_IoT
  password: *redacted*
  power_save_mode: none
  enable_on_boot: True
  fast_connect: On
  output_power: 8.5

This doesn’t seem to have any effect on the device.

1 Like

I can contribute about the issue.
Today arrived TWO esp32 AZDelivery
this model : ESP-32 Dev Kit C su az-delivery.de

with software: ESPHome-Flasher-1.4.0-Windows-x64.exe i flashed BOTH with the SAME firmare one of this i have problem with connection to wifi with
reason=‘Auth Expired’
So i think that this is an hardware problem (one modem only the same distance to the modem with both ESP32).
Now i try to contact the manufacturer

1 Like

I found this thread looking for the same kind of “auth expired” problem.
I had two ESP32 devices (listed on Ali as “ESP32 TYPE-C USB CH340C CP2102 WiFi+Bluetooth Ultra-Low Power Dual Core ESP32-DevKitC-32 ESP-WROOM-32 Expansion Board”).
Neither worked with my config, so I suspected I’d made a mistake.
I switched to a different type of ESP (micro USB instead of USB-C if that matters), and it worked fine.
I then installed WLED on the two non-working ESPs and it installed but could not connect to my network.
I will now contact the seller for a refund on my devices that seem like duds.

Just faced this issue with a D1 Mini clone, and found that forcing the wifi into g only mode does solve the issue.

For reference, this is the code I use (lost the link to the original post) :

on_boot:
  - priority: 300
    then:
      lambda: |-
        WiFi.setPhyMode(WIFI_PHY_MODE_11G);

Hope that it will save some time for somebody looking for a solution for a seemingly random problem.

for my esp32s3 below wifi configuration resolved issue

wifi:
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  reboot_timeout: 15min
  ap:
    ssid: "Esp32-S3-Cam Fallback Hotspot"
    password: "XXXX"
  power_save_mode: none
  enable_on_boot: True
  fast_connect: On
  output_power: 8.5

Hi, did you get this working?
I have the same situation where after programming using the esphome run xyz.yaml tool (DEBUG on) Wifi connects instantly and everything works fine. Then breaking that link and linking using cutecom it just sits and “Auth Expired” the whole time.
What is weird is going back to using esphome logs xyz.yaml and pressing the modules reset button, Wifi works again.
None of the settings in this thread worked sofar.

Tried that, and it did not resolve my ESP32 connection issues. Tried switching from WPA2-Personal to WPA2/WPA3-Personal (it appears to be a newer option) but it’s not helping. Last option is to disable the logger: section as noted above. No, that did not resolve it, either. Quite aggravating.

The blame for the aggravation rests solely with the module/board/ESP32 manufacturer. Two of three ESP32-S3-WROOM-1 boards in a single purchase were BAD. The first would not register correctly with USB, failing to provide a valid Device Descriptor. The second would not connect via WiFi no matter what was attempted. Only the third would actually load and connect.

2 Likes

After struggling with this for a week I finally solved my issue. I popped the shield off the esp module and it looked awful. The solder paste didn’t look like it had melted all the way and components were askew. I reflowed the board, put the shield back on and I get a fast and reliable connection now.

1 Like

I had a similar problem with an ESP32-CAM board. The issue turned out to be the power regulation on the ESP32-CAM-MB. When I directly connected the ESP board the issue went away.

Changing the framrework solved the issue:

esp32:
  board: esp32dev
  framework:
    type: esp-idf
    version: recommended

Change the GPIO from my DHT22 from 13 to 32 also work

sensor:
  - platform: dht
    pin: GPIO32

I have the same issue here with a brand new ESP8266 nodemcu…
The board SHOULD read 3 dallas temperature sensors (DS18b20)… SAME base-config as already used on 11 other boards of the same type…
BASE-Config is done via a common Package… so typos or similar are nearly impossible, as then ALL others also wouldn’t connect,… :wink:

Log of the “new” device directly after flashing with only BASE-Config over usb…

[I][logger:034]: Log initialized
[14:45:20][C][ota:483]: There have been 0 suspected unsuccessful boot attempts.
[14:45:20][I][app:029]: Running through setup()...
[14:45:20][C][wifi:038]: Setting up WiFi...
[14:45:20][C][wifi:051]: Starting WiFi...
[14:45:20][C][wifi:052]:   Local MAC: 8C:AA:B5:76:60:4C
[14:45:20][D][wifi:462]: Starting scan...
[14:45:20][W][component:157]: Component wifi set Warning flag: unspecified
[14:45:26][D][wifi:477]: Found networks:
[14:45:26][I][wifi:520]: - 'PRIVAT' [redacted]▂▄▆█
[14:45:26][D][wifi:522]:     Channel: 12
[14:45:26][D][wifi:523]:     RSSI: -26 dB
[14:45:26][I][wifi:520]: - 'PRIVAT' [redacted]▂▄▆█
[14:45:26][D][wifi:522]:     Channel: 5
[14:45:26][D][wifi:523]:     RSSI: -59 dB
[14:45:26][I][wifi:520]: - 'PRIVAT' [redacted]▂▄▆█
[14:45:26][D][wifi:522]:     Channel: 9
[14:45:26][D][wifi:523]:     RSSI: -63 dB
[14:45:26][I][wifi:520]: - 'PRIVAT' [redacted]▂▄▆█
[14:45:26][D][wifi:522]:     Channel: 6
[14:45:26][D][wifi:523]:     RSSI: -77 dB
[14:45:26][I][wifi:303]: WiFi Connecting to 'PRIVAT'...
[14:45:28][W][wifi_esp8266:504]: Event: Disconnected ssid='PRIVAT' bssid=[redacted] reason='Auth Expired'
[14:45:28][W][wifi:633]: Error while connecting to network.
[14:45:28][D][wifi:677]: Retrying with hidden networks...
[14:45:28][I][wifi:303]: WiFi Connecting to 'PRIVAT'...
[14:45:30][W][wifi_esp8266:504]: Event: Disconnected ssid='PRIVAT' bssid=[redacted] reason='Auth Expired'
[14:45:30][W][wifi:633]: Error while connecting to network.
[14:45:30][D][wifi:677]: Retrying with hidden networks...
[14:45:35][I][wifi:303]: WiFi Connecting to 'PRIVAT'...
[14:45:43][W][wifi_esp8266:504]: Event: Disconnected ssid='PRIVAT' bssid=[redacted] reason='Auth Expired'
[14:45:43][W][wifi:633]: Error while connecting to network.
[14:45:43][D][wifi:677]: Retrying with hidden networks...
[14:45:43][I][wifi:303]: WiFi Connecting to 'PRIVAT'...
[14:45:45][W][wifi_esp8266:504]: Event: Disconnected ssid='PRIVAT' bssid=[redacted] reason='Auth Expired'
[14:45:45][W][wifi:633]: Error while connecting to network.
[14:45:45][D][wifi:677]: Retrying with hidden networks...

I’ve tried to figure out where wifi is setting the “warn-flag” but my “C-experiance” is ways too small for that… :wink:
Has anyone any idea how to get a step further?

!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
EDIT:
Yesterday I tried half the day to get the ESP connected and then decided to post my problem…
A few minutes ago I gave it a next try… and it connected like a charm… No change in equipment, no power cycle anywhere, …
To reproduce the error I reflashed, configured with the desired sensors WITHOUT connecting them and reflashed again… The silly thing connects like a charm…
I think the GREMLINS were visiting me…
!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!

EDIT 2:
NO There were no Gremlins! There is TP-Link!!!
I have 2 TP-Link TL-WA850RE running here, which I have configured as AccessPoint and 2 as Repeater. If the ESP’s try to connect to the AP they log the mentioned “auth expired” and get no connection… if they try to connect to the Repeater everything is fine… Even if the Repeater is connecting to the TP-Link-AP!!! All TP-Links have same settings and firmware…
About 20 Shellies, some Phones and Laptop’s have NO Problem in connecting to the TP-Link AP’s…

Well, gotta say I struck this problem myself over the past couple of days. For the life of me could not work it out. Thought maybe the esp device needed to be fully erased, but no that didn’t help. Tried removing various settings and eventually went to bare basics - nope. Tried fixed ip address, tried all sorts of things. At one point it seemed to fix itself, but then went bad again. Having recently moved over to a TP-Link switch to provide DHCP I thought maybe that was the problem, but no.

The fix - well, in my case I found that the wifi signal for the thing was weak. It worked as soon as I got closer to one of my APs. The auth error I believe was due to the device trying to authenticate with the network but timing out - due to low bandwidth - during the handshake process where the encryption key is shared, and I had recently relocated the AP it would normally have connected to. Turns out the specific esp32 device I was using has a poor antenna, and it usually worked fine in the location it normally lives (as it’s quite close to an AP) but not where I was configuring it. Note that if you have multiple APs like I do, the device may randomly latch on and try to connect to one with a weaker signal - resulting in intermittent issues like those I was experiencing. Also worth checking from the AP side which AP it is trying to connect to.

Something that can help is to use code such as this to monitor the signal strength to help with diagnostics:

  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    id: wifisignal
    update_interval: 60s
    unit_of_measurement: dBm
    accuracy_decimals: 0
    device_class: signal_strength
    state_class: measurement
    entity_category: diagnostic
  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifisignal
    id: wifipercent
    name: "WiFi Signal Percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "Signal %"
    entity_category: "diagnostic"

All the suggestions mentioned are correct and useful…
In MY case, it doesn’t matter which ESP I try to connect to which TP-Link AP… The AP that originally caused my problem had an RSSI of about 60 dbm, while the repeater (that I was able to connect to) was showing about 70 dbm… In MANY attempts, I found out that it made no difference if the connection to the AP showed 40 dbm or 80 dbm…