Using ArcServer 10.1 and JSAPI 3.1. Printtask works when selection of a featurelayer under a feature service is empty. After a selection is made the follow error occurs:
i was suggesting that you test using our own sample secured service first. in this application the token is not stored in the application or in a proxy, but rather allows you to authenticate onLoad of the application by passing the credentials user1/user1.
first try printing our sample service, then switch to your own secure service (and after that, your own print service)
Having to sign in will not work in a production environment (tokens are a necessity), but apparently there is an issue with the authentication service running in my instance of ArcGIS Server 10.1. Up until now I haven't had any issues using secure services. I will case that error down and see if that resolves the issue.
Apparently using printing IWA secured services is no longer supported in 10.4.x because of a vulnerability that existed. So instead of fixing the vulnerability the capability was removed. Wonderful.