Unable to get new token using JWT method (C#)

I am trying to set up a method so each time my application is accessed it retrieves a new token using JWT.

I've ran through the docusign github examples but this is still newer to me so I am stuck unfortunately.


using DocuSign.eSign.Api;
using DocuSign.eSign.Client;
using DocuSign.eSign.Model;
using DocuSign.eSign.Client.Auth;

public string getAccessToken(){
var apiClient = new ApiClient();

            OAuth.OAuthToken authToken = apiClient.RequestJWTUserToken({clientID},
                            "{Impersonated User GUID}",
                            "https://account-d.docusign.com",
Encoding.UTF8.GetBytes(System.Configuration.ConfigurationManager.AppSettings["jwtPrivKey"]),
                            1);

return authToken.access_token;

}

Exception Details: DocuSign.eSign.Client.ApiException: Error while requesting server, received a non successful HTTP code Error with response Body:

Upvotes: 1

Views: 449

Answers (1)

dvo
dvo

Reputation: 2153

I have similar code to what you have. I ran into an issue when I was developing where my auth path variable could not include "https://". I have to use plain "account-d.docusign.com" instead.

Upvotes: 2

Related Questions