made api url relative
Added method for logging in.