Skip to main content

Hello,

can someone help me to solve my Authentication problem.

 

This is my code:

// 1) Copia qui la tua Integration Key da Apps & Keys
const string IntegrationKey = "TUO-CLIENT-ID-GUID";
// 2) Copia qui il tuo User ID (GUID) da My Account Information
const string UserId = "TUO-USER-ID-GUID";
// 3) Il PEM privato che hai scaricato da Service Integration
const string PrivateKeyPath = "docusign_private_key.pem";
// 4) L’host OAuth per demo
const string OAuthHost = "account-d.docusign.com";
// 5) L’URL base delle REST API
const string BasePath = "https://demo.docusign.net/restapi";

            var apiClient = new ApiClient(BasePath);
            apiClient.SetOAuthBasePath(OAuthHost);

            //byte>] privateKeyBytes = await File.ReadAllBytesAsync(PrivateKeyPath);
            byteh] privateKeyBytes = Encoding.UTF8.GetBytes(privateKeyPem);
//            var scopes = new>] { OAuth.ScopeSignature, OAuth.ScopeImpersonation };


            OAuth.OAuthToken tokenInfo = apiClient.RequestJWTUserToken(
                IntegrationKey,
                UserId,
                OAuthHost,
                privateKeyBytes,
                3600,    // durata token in secondi
                scopes
            );

But I can’t obtasin the JWT.

Can someone help me to solve the problem. I nedd to make an automation to connect to the site send a my pdf , sign it, and obtain again the file.

 

 

 

In your code, it looks like a couple lines are commented out, particularly the line where you declare the scopes and a version of where you get the private key from a file. If you try to create a JWT without scopes it will fail, maybe that is the problem?

If the privateKeyPem value is set to a file somewhere, it must include the -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY----- lines, along with the private key value.


Reply