Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying use method RequestJWTApplicationToken to authenticate and create a envelope, like the code below:


private OAuthToken _authToken;
protected static ApiClient _apiClient { get; private set; }


public string GetToken()
{
    _authToken = _apiClient.RequestJWTApplicationToken(
        "<ClientId>",
        "<AuthServer>",
        "<PrivateKeyBytes>",
        1,
        "<Scopes>");
}

public void SendDocumentForSignature()
{
    var envelope = MakeEnvelope("my_email@domain.com", "my name");
    
    var token = GetToken();

    var apiClient = new ApiClient("https://demo.docusign.net/restapi");

    apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + token);
    var envelopesApi = new EnvelopesApi(apiClient);
    EnvelopeSummary results = envelopesApi.CreateEnvelope("<AccountId>", envelope);

    string envelopeId = results.EnvelopeId;
}

But I received the exception below, here envelopesApi.CreateEnvelope("<AccountId>", envelope);:

Error calling CreateEnvelope: {"errorCode":"AUTHORIZATION_INVALID_TOKEN","message":"The access token provided is expired, revoked or malformed. Authentication for System Application failed."

I didn't find any use cases about the RequestJWTApplicationToken method in the documentation or in the" Quick Start "project.

question from:https://stackoverflow.com/questions/65924321/how-to-use-docusign-esign-client-apiclient-requestjwtapplicationtoken

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

The RequestJWTApplicationToken can only be used with a very few DocuSign API methods related to organization management. All of of the eSignature REST API methods require an access token that is associated with a user in an account.

To create such access tokens using the OAuth JWT flow, use the C# RequestJWTUserToken method.

The associated user for some use cases is a "system user" such as "finance@example.com" For other use cases, the user will be a specific named user.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...