I'd just change the security code to something simple and try again or try the push button method.
I have seen this when the router is say set to 802.11n only and the device is 802.11g. Strange oversight on WiFi design that it can see the access point and fail like you wrote about.
I have a Windows 10 Lenovo laptop that my son gave me. I signed on to the router with the security code that has been used by my three other laptops to sign on and they work. With this laptop I get an error message that says the security code that I entered is invalid.
Can anyone identify this problem and what do I need to do to fix it.