Added support for re-authentication (closes #293, closes #166, closes #42)