0
votes

I am using the code from the Code Recipes for Embedded signing but converted from C# to VB.NET, the code uses the Docusign API Nuget. The CreateEnvelope returns a USER_LACKS_PERMISSIONS. I have gone through my permissions and checked everything. The user I am logging in with is an Account Administrator and seems to have all permissions checked. I am setting the Recipient Email to the actual recipient email (different from my administrator account) even though it's embedded signing, I don't know if that is the problem. I do want the actual signer to get a copy of the signed document which is why I am using the recipient email as the RecipientEmail.

Below is the code that causes the error:

        Dim accountId As String
        accountId = loginApi()


        Dim envDef As New DocuSign.eSign.Model.EnvelopeDefinition()
        envDef.EmailSubject = "TEST - Please sign this doc"

        ' Add a document to the envelope
        Dim doc As New DocuSign.eSign.Model.Document()
        doc.DocumentBase64 = System.Convert.ToBase64String(DocumentBytes)
        doc.Name = "TestFile.pdf"
        doc.DocumentId = "1"

        envDef.Documents = New List(Of DocuSign.eSign.Model.Document)()
        envDef.Documents.Add(doc)

        ' Add a recipient to sign the documeent
        Dim signer As New DocuSign.eSign.Model.Signer()
        signer.Email = recipientEmail
        signer.Name = recipientName
        signer.RecipientId = "1"
        signer.ClientUserId = "1234"
        ' must set |clientUserId| to embed the recipient!
        ' Create a |SignHere| tab somewhere on the document for the recipient to sign
        signer.Tabs = New DocuSign.eSign.Model.Tabs()
        signer.Tabs.SignHereTabs = New List(Of DocuSign.eSign.Model.SignHere)()
        Dim signHere As New DocuSign.eSign.Model.SignHere()
        signHere.DocumentId = "1"
        signHere.PageNumber = "1"
        signHere.RecipientId = "1"
        signHere.XPosition = "100"
        signHere.YPosition = "100"
        signer.Tabs.SignHereTabs.Add(signHere)

        envDef.Recipients = New DocuSign.eSign.Model.Recipients()
        envDef.Recipients.Signers = New List(Of DocuSign.eSign.Model.Signer)()
        envDef.Recipients.Signers.Add(signer)

        ' set envelope status to "sent" to immediately send the signature request
        envDef.Status = "sent"

        ' |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
        Dim envelopesApi As New DocuSign.eSign.Api.EnvelopesApi()
        Dim envelopeSummary As DocuSign.eSign.Model.EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef)

These are the permissions: enter image description here

2
Can you confirm the user credentials you are using is configured for "Account-Wide Rights" in the admin tool? - Luis Scott
FYI there is also an account level setting that allows embedded signing via API to be allowed. Can you include the full error message + details so we can narrow this down? - Luis Scott
These are the permissions. I see everything checked. - user3438914

2 Answers

0
votes

The first issue when diagnosing a problem like this is to figure out if it is a credentials (permissions) problem or something else.

There's an easy test for to see if the user name is set up right:

Run the Recipe tester. You can quickly run it for free on Heroku. See the "Deploy on Heroku" button. Choose the Embedded Signing recipe. If it works with your user demo sandbox email/password then you know that the problem lies somewhere in your code.

You can use the tool to authenticate using either OAuth or DocuSign Legacy authentication (Service Integration authentication.)

Next, use the tester's API log feature to see the API calls of your VB program. Compare the DocuSign API requests that your program is making vs the requests from the Recipe tester.

0
votes

The heroku app used a post that goes to: https://demo.docusign.net:7802/restapi/v2/accounts/13193/envelopes

Whereas my visual studio app uses the production url: https://www.docusign.net/restapi

All this time I was checking the permissions of the user in demo.docusign.net But it turns out ANOTHER USER WITH THE SAME EMAIL and password existed in production (www.docusign.net) The production account did not have the correct permissions.

The fact that the DocuSign app showed me the "Select User" page first, showing two identical entries was the clue that TWO ACCOUNTS EXIST: one in production and one in demo.

It would be nice if in the "Select User" page, DocuSign listed the BASE URL as well, or a column showing Production or Demo.