Refactor auth + minor improvements
Fix uri