Fix endless login redirect loop and authorize