Handle authentication errors (closes #98)

Signed-off-by: Daniele Ricci <daniele.athome@gmail.com>