Better and more flexible auth handling