Add better checking for failed authentication in the worker

Change-Id: I4b1e286e8caf6ec6019254d5754ce0366b171a45
Merge "Add better checking for failed authentication in the worker"