Search code examples
jwtdocusignapienvelope

Docusign not showing recipientview on Embedded signing instead shows Admin View


I am going on rounds for the past 4 days with this problem and unable to figure out why. .Using Python and JWT Auth , when a user logs into our app they need to add some fields and that data needs to be filled in the Docusign template for the user to sign. Here the impersonation is not working . Every time I open the Docusign file it opens it on my creds - Admin Mode( I got consent as an admin).Not as the signer specified like below. Can someone help ?

apiClient = DsClient.update_token()

apiClient.host = "https://na3.docusign.net" + "/restapi"     

   with open(path.join( '/app/templates/', 'sasa.pdf'), "rb") as file:
        content_bytes = file.read()
   base64_file_content = base64.b64encode(content_bytes).decode('ascii')

    # Create the document model
   document = Document( 
        document_base64 = base64_file_content,
        name = 'Example document', 
        file_extension = 'pdf', 
        document_id = 1 
    )
   signer = Signer( 
        email = '[email protected]', name = 'abc',
        recipient_id = "1", routing_order = "1",
        client_user_id = '123',
        role_name = 'Signer'
    )
   
   
   sign_here = SignHere(  
            anchor_string="/sn1/", anchor_units="pixels",
            anchor_y_offset="10", anchor_x_offset="20"
        )


   signer.tabs = Tabs(sign_here_tabs = [sign_here])
  
   
   envelope_definition = EnvelopeDefinition(
    email_subject = "Please sign this document sent from the Python SDK",
    documents = [document],
    recipients = recipients.Recipients(signers = [signer]),
    status="sent"
    )

   envelope_api = EnvelopesApi(apiClient)
   
   results = envelope_api.create_envelope(session['account_id'], envelope_definition=envelope_definition)
   envelope_id = results.envelope_id
   
   recipient_view_request = RecipientViewRequest(
            authentication_method='None',
            client_user_id='123',  
            return_url="http://localhost:3000/",
            user_name='xyz', 
            email="[email protected]
            
        )
  
   results = envelope_api.create_recipient_view(account_id=session['account_id'],envelope_id=envelope_id,recipient_view_request=recipient_view_request)  
   return jsonify({"envelope_id": envelope_id,'redirect_url': results.url})

CREATE RECIPIENT VIEW

POST https://na3.docusign.net:8832/restapi/v2.1/accounts/f9bbb4d1-b163-40b9-9f24-8473123310dd/envelopes/dfa2eb5c-db75-45b3-b1b8-941c09750c01/views/recipient
Content-Length: 151
Content-Type: application/json
Accept: application/json
Accept-Encoding: identity
Authorization: Bearer [omitted]
Host: na3.docusign.net
User-Agent: Swagger-Codegen/v2.1/3.9.0rc1/python3
X-DocuSign-SDK: Python
X-Forwarded-For: 107.129.120.208
X-SecurityProtocol-Version: TLSv1.2
X-SecurityProtocol-CipherSuite: ECDHE-RSA-AES256-GCM-SHA384

{
    "authenticationMethod": "None", 
    "clientUserId": "123", "email": "[email protected]", 
    "returnUrl": "http://localhost:3000/", "userName": "Shilpa"
}

201 Created

Content-Type: application/json; charset=utf-8
Content-Length: 1466
X-DocuSign-TraceToken: eccb191e-e3f3-4cba-9f30-59f85dce54c5

{"url":"https://na3.docusign.net/Signing/MTRedeem/v1/eccb191e-e3f3-4cba-9f30-59f85dce54c5/na?29yaXRobSI6MCwiSGFzaFJvdW5....tw"}

Solution

  • The problem was there were multiple anchor_string="/sn1/" in the document so it kept failing to add a signature tab which lead to the admin view. Docusign support was able to resolve it for me .Thanks .

    It would have been really nice if it was able to throw an error for it , instead it simply opened it in Admin or a view where user was able to do anything on the form.