This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Issue

Attempting to connect to the SourceCode.Workflow.Client API with static credentials results in error:

"ClientException: Authentication failed for user K2Service

SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder builder = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
builder.Authenticate = true;
builder.Host = "k2.denallix.com";
builder.Port = 5252;
builder.Integrated = false;
builder.IsPrimaryLogin = true;
builder.SecurityLabelName = "K2";
builder.WindowsDomain = "DENALLIX";
builder.UserID = "K2Service";
builder.Password = {password}";
SourceCode.Workflow.Client.Connection WorkflowClientConnection = new SourceCode.Workflow.Client.Connection();
WorkflowClientConnection.Open("k2.denallix.com", builder.ConnectionString);"

Symptoms

Although the WindowsDomain field is specified, the UserID field is expecting a string in the format "DOMAIN\username".

Resolution

Specify the UserID in the 'DOMAIN\username' format, i.e.:

builder.UserID = @"DENALLIX\K2Service";