MS Dynamics CRM online 2011 - Authentication issues

Solution 1:

This is the simplest way to connect to CRM Online, you need only to add reference to Microsoft.Xrm.Sdk.Client and Microsoft.Xrm.Client.Services

CrmConnection crmConnection = CrmConnection.Parse("Url=https://XXX.crm.dynamics.com; [email protected]; Password=passwordhere;");
OrganizationService service = new OrganizationService(crmConnection);

Entity account = new Entity("account");
account ["name"] = "Test Account";

Guid accountId = service.Create(account); 

Refers to this msdn article for create the right connection string

Simplified Connection to Microsoft Dynamics CRM