Its very easy to discover WiFi credentials of networks that your phone was already connected to.
All you need to do is to open "/data/misc/wifi/wpa_supplicant.conf" file.
You can use ADB to pull this file out or you can just use Root Explorer or other file explorer on your phone.
You will get all configured WiFi networks with SSID,Password,Encryption Type & Priority.
P.S. : Or you can use this nice tool to discover WiFi Credentials.
P.S. : Or you can use this nice tool to discover WiFi Credentials.