Are you using two-factor authentication on the account : Using app-specific passwords - Apple Support ?
To generate and use app-specific passwords, your Apple ID must be protected with two-factor authentication.
You also need an app-specific password for your devices that use Mac OS X Lion 10.7.5 and earlier or iOS 5 and earlier. If you don’t have devices that can be updated to iOS 9 or OS X El Capitan, you can set up two-step verification and generate app-specific passwords.