Trim some inputs, properly build url params for authentication