Intermittent SSL failures on M5Stack are often due to missing or outdated root CA and limited heap during handshake. Did you try pinning the server certificate or loading only the required CA bundle and checking free heap before the request, and handling token refresh server side instead of on device?