title: Connection request failed while connecting to sharepoint online
body: <p>I am trying to connect sharepoint online i used the following code but the response it is showing is request failed . I tried the following code</p>
  
  <pre><code>@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0-RC2' )
  import groovyx.net.http.*;
  import static groovyx.net.http.ContentType.*;
  import static groovyx.net.http.Method.*;
  import groovyx.net.http.HTTPBuilder;
  import static groovyx.net.http.Method.GET;
  import static groovyx.net.http.ContentType.TEXT;
  import groovyx.net.http.RESTClient
  import groovy.util.slurpersupport.GPathResult
  import static groovyx.net.http.ContentType.URLENC
  import groovyx.net.http.URIBuilder
  
  def authSite = new HTTPBuilder( 'https://xyzsharepoint.com' );
  authSite.auth.basic 'username', 'password';
  authSite.request(GET) { req-&gt;
      response.success = { resp-&gt;
          println'request was successful'
          assert resp.status&lt;400
      }
      response.failure = { resp -&gt;
          println'request failed'
          assert resp.status&gt;=400
      }
  }
  </code></pre>
  
  <p>Suggest me where I went wrong. </p>