React Docusign Clickwrap Credentials

。_饼干妹妹 提交于 2021-02-10 18:00:56

问题


In my react application, when Im rendering the Docusign clickwrap, I need to supply the accountId and the clickwrapId. Is there a secure way to reference the accountId/clickwrapId without actually putting those values in. I dont want to expose those credentials in my react application


function App() {
  React.useLayoutEffect(() => {
    docuSignClick.Clickwrap.render({
      environment: 'https://demo.docusign.net',
      accountId: '...',
      clickwrapId: '...',

      onMustAgree(agreement) {
        // Called when no users have previously agreed by the above client user ID for the most recent required Clickwrap version
      },

      onAgreed(agreement) {
        // Called when either 1) the clientUserId has previously agreed 2) the clientUserId has clicked agree and completed successfully
      },

      onDeclined(agreement) {
        // Called when the clientUserId has declined successfully
      }
    }, '#ds-clickwrap');
  }, []);

  return <div id="ds-clickwrap" />
}

回答1:


Ah, you can use the server-side API to generate an agreement URL instead if that is desired.

POST /clickapi/v1/accounts/.../clickwraps/.../agreements: Only the clientUserId is required to make this API call. You would do this from your server and then pass the URL from the response to the client.

{
   "clientUserId": "..."
}

This would return an agreement URL to then be used in the snippet of JS:

{
   ...
   "status": "created",
   "agreementUrl": "https://...."
}

This agreementUrl could then be used in the snippet:

docuSignClick.render({
   agreementUrl: '...agreementUrl from REST API response...',

   onAgreed...
}, '#ds-clickwrap');


来源:https://stackoverflow.com/questions/64163449/react-docusign-clickwrap-credentials

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!