2016-04-12 30 views
1

ben şu kodu as mentioned here çalışıyorum devre dışıDocuSign Entegratörü Anahtar bulunamadı belirtilen veya

public string loginApi(string usr, string pwd) 
{ 
// we set the api client in global config when we configured the client 
ApiClient apiClient = Configuration.Default.ApiClient; 
string authHeader = "{\"Username\":\"" + usr + "\", \"Password\":\"" + pwd + "\", \"IntegratorKey\":\"" + INTEGRATOR_KEY + "\"}"; 
Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader); 

// we will retrieve this from the login() results 
string accountId = null; 

// the authentication api uses the apiClient (and X-DocuSign-Authentication header) that are set in Configuration object 
AuthenticationApi authApi = new AuthenticationApi(); 
LoginInformation loginInfo = authApi.Login(); 

// find the default account for this user 
foreach (LoginAccount loginAcct in loginInfo.LoginAccounts) 
{ 
    if (loginAcct.IsDefault == "true") 
    { 
     accountId = loginAcct.AccountId; 
     break; 
    } 
} 
if (accountId == null) 
{ // if no default found set to first account 
    accountId = loginInfo.LoginAccounts[0].AccountId; 
} 
return accountId; 
} 

Öyle bir deneyin catch ile sarılmış ve bu hatayı fark, çalışmıyor,

Error calling Login: { 

"errorCode": "PARTNER_AUTHENTICATION_FAILED", 

"message": "The specified Integrator Key was not found or is disabled." 

} 

Ben fiddler bakmak,

enter image description here

İstek, www.docusign.net adresine giderken, https://demo.docusign.net adresine göndermek istiyorum. Bu kod için Base Uri'yi nasıl değiştirebilirim?

cevap

5

Tamam, sorunu çözdünüz. Hata mesajı yanıltıcıdır.

Adım 1 - Yapılandırma nesnesini oluşturmam gerekiyor gibi görünüyor.

ApiClient client = new ApiClient(basePath: "https://demo.docusign.net/restapi"); 
      Configuration cfg = new Configuration(client); 

Adım 2 - Ben gayri resmi .NET kendini sunan bir kimlik doğrulama sorunu vardı Api yapıcısı

AuthenticationApi authApi = new AuthenticationApi(cfg); 
+0

üzerine auth başlığını

cfg.AddDefaultHeader("X-DocuSign-Authentication", authHeader); 

Adım 3 Geçiş bunu ayarlamak için İhtiyacı Yalnızca temel NuGet paketi; ancak vurguladığınız gibi yeni bir Yapılandırma örneğini başlatmanızın çözdüğü anlaşılıyor. Thx: D – ne1410s

İlgili konular