docusign / docusign-esign-csharp-client

The Official Docusign C# Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://developers.docusign.com/docs/esign-rest-api/sdks/csharp/
MIT License
130 stars 159 forks source link

Unsure of credentials for ApiClient call #334

Closed andyfensham closed 3 years ago

andyfensham commented 3 years ago

I am using version 4.3.0 of the Docusign.eSign.dll, and I am having trouble filling the relevant fields.

The Auth Header contains :

Username -> using my username I used to create the account with docusign Password -> use my docusign sign in password IntegratorKey -> use the Integration key under "https://admindemo.docusign.com/apps-and-keys"

My code looks like this and my devs used it and all tests passed, so I am not sure if the keys I am using is wrong.

`private void GetAccountId() { try { var client = new ApiClient(_credentials.BaseUrl); Configuration.Default.ApiClient = client; var authHeader = "{\"Username\":\"" + _credentials.Username + "\", \"Password\":\"" + _credentials.Password + "\", \"IntegratorKey\":\"" + _credentials.ApiKey + "\"}"; Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);

            var authApi = new AuthenticationApi();
            var loginInfo = authApi.Login();
            AccountId = loginInfo.LoginAccounts[0].AccountId;

            string[] separatingStrings = { "/v2" };
            client = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl.Split(separatingStrings, StringSplitOptions.RemoveEmptyEntries)[0]);
        }
        catch (Exception)
        {
            throw;
        }
    }`

The error I get is that I need docusign credentials

LarryKlugerDS commented 3 years ago

You're attempting to use the obsolete DocuSign Legacy Authentication system.

It has not been supported for several years now. All new applications should use an OAuth flow.

All applications, including applications already in production, will need to be updated to use an OAuth flow by September, 2022. See the announcement

If you have any problems using an OAuth flow, StackOverflow with tag docusignapi is a good place for questions. /Larry

LarryKlugerDS commented 3 years ago

Also: the Login() method is obsolete and not supported for new apps either.

Once you have an access token (the result of an OAuth flow), use the GetUserInfo method to learn the user's account id, name, and other information.