简体   繁体   中英

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM