I have a Samsung Galaxy Tab SM-T530NU running Android 4.2.2. The Wifi connects fine at home, hotels, etc. I have one place that I frequent that it will not connect to the router. Almost everyone in the building has a tablet of some sort or use their cell phones and they all connect fine. When I select the proper Wifi connection and enter the password, which I confirmed, I get "connecting", "obtaining IP address" then "connection failed". This is the only place where I do not connect. Any ideas as to what the problem might be?
Try this and let me know if it solves it. Go to "Settings" and turn off the wifi. Wait 30 seconds. Turn it back on and most devices will quickly connect.
Some routers require you to login on a web portal with a password. For example I have a router at home that dose the same as you explain but you can not login until you open a browser and enter the password.