Handle authentication correctly