Can't resolve the Packer experienced an authentication error when trying to connect via SSH

Hello,
I am trying to deploy a centos7 vm on Vsphere using packer, and packer is returning the following error: " Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain".
However, I can connect normally to the vm through ssh using the credentials written in my hcl file.
Could anyone help me with this issue please?

Double check your ks.cfg and HCL/build file. I’ve had this problem before with Ubuntu and its pressed file, the ssh credentials did not match in both files.

I have kind of the same problem, like I run my build locally and everything builds without issue. But when it runs via Jenkins, I get the following errors from the Jenkins agent.

[1;32m==> qemu: Using ssh communicator to connect: localhoste[0m
2021/04/01 16:26:44 packer-builder-qemu plugin: Using host value: localhost
2021/04/01 16:26:44 packer-builder-qemu plugin: [INFO] Waiting for SSH, up to timeout: 5m0s
e[1;32m==> qemu: Waiting for SSH to become available…e[0m
2021/04/01 16:26:44 packer-builder-qemu plugin: Using host value: localhost
2021/04/01 16:26:44 packer-builder-qemu plugin: [INFO] Attempting SSH connection to localhost:3220…
2021/04/01 16:26:44 packer-builder-qemu plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/04/01 16:26:44 packer-builder-qemu plugin: [DEBUG] handshaking with SSH
2021/04/01 16:26:44 packer-builder-qemu plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Agent has KVM/QEMU and packer in place

I solved my problem by enabling Inject USB HID scan codes in Vsphere

i’m also facing the same issue while running from jenkins.
could you please explain how did u resolve this issue ?