Add authentication. Fix #529