use this code to authenticate with SharePoint online office 360.string userName = Your user Name;string password = Pasword;string baseurl = "Share point URL";Uri uri = new Uri(baseurl);var securePassword = new SecureString();foreach (var c in password) { securePassword.AppendChar(c); }var credentials = new SharePointOnlineCredentials(userName, securePassword);var authCookie = credentials.GetAuthenticationCookie(uri);var fedAuthString = authCookie.TrimStart("SPOIDCRL=".ToCharArray());if (fedAuthString != null){result.UserToken = fedAuthString;result.Message = "User has been logged in successfully";}else{result.Message = "Invalid User!!";}