0
votes

I am trying to integrate docusign rest api in my web application where my .net version is 4.7.2. I have used docusign dll of version 5.2.0.

I am trying to get access token using jwt auth type. So I set up app, integrator key and rsa private key for app.

                var scopes = new List<string>{"impersonation","signature"}
          
                string directorypath = Server.MapPath("~/App_Data/" + "Files/");
                string fileNameOnly = "docusign_private_key.txt";

                var filePath = Path.Combine(directorypath, fileNameOnly);
                var privateKeyBytes = System.IO.File.ReadAllBytes(filePath);

                var apiClient = new ApiClient();
                var authToken = apiClient.RequestJWTUserToken
                    (
                        clientId: credential.ClientID,
                        userId: credential.UserID,
                        oauthBasePath: credential.BasePath,
                        privateKeyBytes: privateKeyBytes,
                        expiresInHours: 1,
                        scopes: scopes
                    );

I used integrator key as clientId, API Username as UserId, https://demo.docusign.net/restapi as oauthBasePath. Is there anything I forgot to mention or make mistake? I am not able to get access token. It throws ApiException with message Error while requesting server, received a non successful HTTP code Error with response Body

1

1 Answers

0
votes

To generate JWT token in demo environment, change your oauthBasePath to account-d.docusign.com ( authentication server ). You can read more here. https://demo.docusign.net/restapi is the application base path you can use to make calls to all eSignature endpoints.