title: How to connect to CRM using SDK (claims based authentication and custom STS)
body: <p>I configured claims based authentication on my CRM instance. I'm using custom STS (Example available <a href="http://cloudythoughts.siadis.com/windows-azure/windows-azure-appfabric/creating-a-custom-sts-with-windows-identity-foundation" rel="nofollow">here</a>) Now I want to access to web services from some test application.
  Does anyone have some example for this?
  I tried with same code for connection in case of windows auth. but, ofcourse, unsuccessful.
  I'm getting an error:</p>
  
  <blockquote>
    <p>{"The authentication endpoint Kerberos was not found on the configured
    Secure Token Service!"}</p>
  </blockquote>
  
  <p>This is code for connection (for AD authentication type):</p>
  
  <pre><code>OrganizationServiceProxy orgserv;
        ClientCredentials clientCreds = new ClientCredentials();
        ClientCredentials devCreds = new ClientCredentials();
  
  
          clientCreds.Windows.ClientCredential.UserName = "user";
          clientCreds.Windows.ClientCredential.Password = "P@$$w0rd";
          clientCreds.Windows.ClientCredential.Domain = "myDomain";
          IServiceConfiguration&lt;IOrganizationService&gt; orgConfigInfo =
                      ServiceConfigurationFactory.CreateConfiguration&lt;IOrganizationService&gt;(new Uri("https://myCRMServer/myOrg/XRMServices/2011/Organization.svc"));
  
          using (orgserv = new OrganizationServiceProxy(orgConfigInfo, clientCreds))
          {
            orgserv.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
            orgserv.EnableProxyTypes();
            connection = orgserv;
          }
  </code></pre>
  
  <p>I found somewhere that for claim based authentication is enough to send only UPN (User Principal Name). But the same error happens. I also tried with username/password combination and it was unsuccessful.</p>
  
  <pre><code>AuthenticationCredentials authCredentials = new AuthenticationCredentials();
  </code></pre>
  
  <p>...</p>
  
  <pre><code>authCredentials.UserPrincipalName = "user";
  </code></pre>
  
  <p>...</p>
  
  <pre><code>authCredentials.ClientCredentials.UserName.UserName = _userName;
  authCredentials.ClientCredentials.UserName.Password = _password;
  </code></pre>
  
  <p>Error after this is: <code>The authentication endpoint Username was not found on the configured Secure Token Service!</code></p>