You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a7276db
Browse filesBrowse the repository at this point in the historyBrowse files
feat(credentials): DocuSign JWT Grant credentials next to OAuth
A saved DocuSign credential that authenticates with JWT Grant (an
integration key, an impersonated user ID, the app's RSA private key, and an
environment), offered as a second option beside the existing OAuth
connection, which is unchanged.
The minter signs an RS256 assertion (iss = integration key, sub = user,
aud = the environment's authentication host without a scheme, scope
"signature impersonation"), exchanges it at that host's /oauth/token, then
reads /oauth/userinfo on the same host to bind the pinned account (or the
user's default) and returns its eSignature REST base. Both hosts come only
from the stored environment; a base_uri outside that environment's
docusign.net shape is never trusted with the token. GUIDs and the key are
checked before any request, and tokens are re-minted about 15 minutes
before they expire, as DocuSign advises.
DocuSign tools take the account base as an authoritative credential param,
so a caller can never supply it, and DocuSignClient skips its
deployment-host userinfo lookup when one is bound. OAuth tokens resolve
exactly as before.
Save-time failures map to consent_required (the connect modal shows the
exact consent URL for the key and environment) and account_not_found (a
pinned account the user does not belong to), alongside the shared
invalid_credentials and provider_unavailable codes.
Connect DocuSign with JWT Grant when a workflow should keep working without anyone signing in again. Sim signs a short-lived assertion with your app's RSA private key, exchanges it for an access token that acts as one DocuSign user, and repeats that every hour. DocuSign issues no refresh token for JWT Grant, so nothing expires as long as the key and the user's consent stay in place.
10
+
11
+
Every envelope, template, and download runs as the impersonated user, with that user's DocuSign permissions. Use a dedicated user when you can.
12
+
13
+
## Prerequisites
14
+
15
+
- A DocuSign account in the environment you want: a free developer account (demo) or a production account
16
+
- Admin access to **Apps and Keys** in that account, to create the integration key
17
+
18
+
## Create the integration key [#creating-the-integration-key]
19
+
20
+
<Steps>
21
+
<Step>
22
+
In DocuSign, open the **Apps and Keys** page and add an app. Give it a name (e.g. `Sim workflows`) and click **ADD**
23
+
</Step>
24
+
<Step>
25
+
Copy the integration key DocuSign assigns (a GUID)
26
+
</Step>
27
+
<Step>
28
+
Under **RSA key pair**, click **GENERATE RSA**. Copy the private key before you close the dialog, including its `BEGIN` and `END` lines. DocuSign masks it afterwards and can't show it again
29
+
</Step>
30
+
<Step>
31
+
Under **Redirect URI**, click **ADD URI** and enter the address you open Sim at (for example `https://sim.ai`). DocuSign requires a redirect URI for the consent step; Sim never uses what it receives there
32
+
</Step>
33
+
<Step>
34
+
Leave **User Application** set to **Yes** (the default) and click **SAVE**
35
+
</Step>
36
+
</Steps>
37
+
38
+
<Callouttype="warn">
39
+
The private key lets anyone holding it act as any user who has consented to this integration key. Sim encrypts it at rest and never shows it again. Treat it like a password.
40
+
</Callout>
41
+
42
+
## Find the user ID [#finding-the-user-id]
43
+
44
+
The **Apps and Keys** page shows your **User ID** and **API Account ID**, both GUIDs. To act as a different user, use that user's ID instead. Use the user ID, not an email address.
45
+
46
+
The account ID is optional. Sim uses the user's default account unless you enter one, so you only need it when the user belongs to more than one account.
47
+
48
+
## Add the credential to Sim [#adding-the-credential-to-sim]
49
+
50
+
<Steps>
51
+
<Step>
52
+
Open **Integrations** from your workspace sidebar
53
+
</Step>
54
+
<Step>
55
+
Search for "DocuSign" and open it, then click **Add to Sim** and choose **Add JWT Grant app**
56
+
</Step>
57
+
<Step>
58
+
Choose the **Environment** the integration key was created in: **Developer (demo)** or **Production**. A key that hasn't gone live only works in the developer environment
59
+
</Step>
60
+
<Step>
61
+
Paste the integration key, the impersonated user ID, the RSA private key, and optionally the account ID
62
+
</Step>
63
+
<Step>
64
+
Click **Add JWT Grant app**. Sim requests a token and reads the user's accounts once to check everything matches
65
+
</Step>
66
+
</Steps>
67
+
68
+
## Grant consent [#granting-consent]
69
+
70
+
DocuSign won't issue tokens for a user until that user (or an organization admin) consents to the integration key. The first time you add the credential, Sim shows an error with the exact consent link for your integration key and environment. Open the link signed in as the impersonated user and click **Accept**. DocuSign then redirects to the redirect URI you added; the page it lands on doesn't matter, so close it and add the credential again.
71
+
72
+
You only need to consent once per user and integration key, unless the user revokes it.
73
+
74
+
## Use the credential in workflows [#using-the-credential-in-workflows]
75
+
76
+
Add a DocuSign block and select the saved credential in the account dropdown. Every DocuSign operation works with it the same way as with a connected account. Sim calls the eSignature REST API for the account it found when it last requested a token, in the environment stored on the credential.
77
+
78
+
Knowledge base syncs from DocuSign look up the account through your deployment's DocuSign OAuth host and always use the user's default account. Use a JWT Grant credential there only when its environment matches the deployment's, and connect a personal account when you need a non-default account.
79
+
80
+
## Fix connection errors
81
+
82
+
| Error | What to check |
83
+
| ----- | ------------- |
84
+
| Needs the impersonated user's consent | Open the consent link from the error signed in as that user, accept, and add the credential again. Consent can also be revoked later, which stops runs until it is granted again |
85
+
| Couldn't authenticate | The integration key, user ID, and private key must belong to the same app, in the environment you chose. A key created in the developer environment isn't valid in production until it goes live. A private key from a deleted keypair no longer works |
86
+
| User isn't a member of the account | The account ID you entered isn't one the user belongs to. Check it, or leave it blank |
87
+
88
+
To rotate the key, generate a new RSA keypair on the integration key, reconnect the credential in Sim with the new private key, test a workflow, then delete the old keypair. DocuSign allows up to five keypairs per integration key. See [DocuSign's JWT Grant documentation](https://developers.docusign.com/platform/auth/jwt/jwt-get-token/).
Copy file name to clipboardExpand all lines: apps/docs/content/docs/integrations/docusign.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,12 @@ import { ReferenceDetails } from "@/components/ui/reference-details"
11
11
12
12
{/* MANUAL-CONTENT-START:intro */}
13
13
Use [DocuSign](https://www.docusign.com) to send envelopes for e-signature, create them from templates, inspect recipients and signing status, and download completed documents. Pending envelopes can be voided with a reason.
14
+
15
+
Connect a DocuSign account through OAuth, or an integration key that acts as one user through [JWT Grant](/integrations/docusign-service-account).
Sim requests these scopes when someone connects a DocuSign account. For a self-hosted deployment, register your own app with the provider using the settings below. See [Integrations and OAuth](/platform/self-hosting/integrations-oauth) for setup.
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/integrations/components/connect-service-account-modal/client-credential-account-modal.tsx
? `${descriptor.serviceLabel} needs the impersonated user's consent first. Add ${redirectUri} as a redirect URI on the integration key, open this link signed in as that user, accept, then try again: ${consentUrl}`
77
+
: `${descriptor.serviceLabel} needs the impersonated user's consent first. See the setup guide.`
0 commit comments