Fix authentication after session expiration

Should fix #22.