【问题标题】:DocuSign Implicit Grant with SalesforceSalesforce 的 DocuSign 隐式授权
【发布时间】:2020-10-25 20:02:45
【问题描述】:

我正在使用 Rest API 将 DocuSign 与 salesforce 集成以发送信封。 在发送任何信封之前,我正在处理隐式授权以生成令牌,但我不确定获取令牌的正确方法是什么。 我正在使用 GET 方法,但我得到的是 HTML 格式的响应。

public class SendDocumentsWithDocuSign {  
    
    public void test(){
        String accountID = 'a6e74d5a-****-****-****-28f3bec67ccf'; 
        String userName = 'f2326e06-****-****-****-a1aee682da08'; 
        String passWord = 'password@123'; 
        String integrationKey = 'b19b477c-****-****-a8a5-8ff88ea771cc';
        String templateID = '5259faf7-****-****-a493-ba19ce5d633c'; 
        String redirectURL='https://www.salesforce.com';
        
        //Request the implicit grant
        String TOKEN_URL = 'https://account-d.docusign.com/oauth/auth?response_type=token&scope=signature&client_id='+integrationKey+'&redirect_uri='+redirectURL;
        String authenticationHeader = 
            '<DocuSignCredentials>' + 
            '<Username>' + userName+ '</Username>' +
            '<Password>' + password + '</Password>' + 
            '<IntegratorKey>' + integrationKey  + '</IntegratorKey>' + 
            '</DocuSignCredentials>';           
        
        
        HttpRequest httpreq = new HttpRequest();
        HttpResponse httpres = new HttpResponse();
        Http httpCall = new Http();        
        
        httpreq.setEndpoint(TOKEN_URL);
        httpreq.setMethod('GET');
        //httpreq.setHeader('X-DocuSign-Authentication', authenticationHeader);
        httpreq.setHeader('Content-Type', 'application/json');
        httpreq.setHeader('Accept', 'application/json');
        httpres = httpCall.send(httpreq);
        System.debug(httpres.getHeaderKeys());
        System.debug(httpres.getHeader('X-DocuSign-TraceToken'));
        System.debug(httpres.getHeader('Set-Cookie'));
        System.debug(httpres.getBody());
}
}

我得到以下输出。

[32]|DEBUG|(X-DocuSign-Node, X-Content-Type-Options, X-DocuSign-TraceToken, Pragma, Date, X-Frame-Options, Strict-Transport-Security, Cache-Control, Content-Security-Policy, Set-Cookie, ...)
[33]|DEBUG|4d4cac98-7cc9-4b3e-a1fe-c12e871b7065
[34]|DEBUG|__RequestVerificationToken=ARFea2sGN3iGpAjBGHGwCJcB0; path=/; secure; HttpOnly
[35]|DEBUG|

 input name="__RequestVerificationToken" type="hidden" value="ARFea2sGN3iGpAjBGHGwCJcAAAAA0"

我想获取访问令牌以调用 DocuSign 文档中给出的 REST API。 https://developers.docusign.com/platform/auth/implicit/implicit-get-token

【问题讨论】:

    标签: docusignapi docusignapextoolkit


    【解决方案1】:

    要使用 DocuSign APEX 工具包,您需要遵循工具包的身份验证方法,因为这是使用 APEX 工具包中(所需)集成密钥的唯一方法。

    查看工具包的authentication instructions

    如果您不使用 APEX 工具包,那么您需要在 SalesForce 的能力范围内工作。 Named Credentials 是一种方法。 Here's另一个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-21
      • 2020-03-04
      • 1970-01-01
      • 2016-05-24
      • 2018-06-19
      • 2017-02-04
      • 2022-06-15
      相关资源
      最近更新 更多