We have integrated docusign into our application and are able to create an Envelope, add signers and create a recipient view url via the docusign API.
The next step is to allow the sender to view the envelope and to do so we are using the create sender view
API. We are able to make the request successfully and a url is returned.
Our API that calls the create sender view API
:
# the url to return to e.g. https://mywebsite.com
return_url = ReturnUrlRequest(return_url=data["return_url"])
# call the docusign API
results = envelope_api.create_sender_view(
session["ds_account_id"],
envelope_id,
return_url_request=return_url
)
# returns a json object with the url to the client
return jsonify({"url": results.url}
Example url returned from the docusign api call: https://demo.docusign.net/Member/StartInSession.aspx?StartConsole=1&t=xxxx&DocuEnvelope=xxxx&send=1
The URL is passed to the front-end web application (ReactJs) and it is used to redirect the user to the sender view page. e.g. window.location = response.data.url
.
This is where the issue occurs:
Instead of redirecting the user to the docusign website, the user is immediately redirected back to the application.
When I copy the url and manually paste it in a new browser tab it immediately redirects me back to the application, but the second time I visit the url in a new tab it works.
Am I missing something?
Create sender view docs: https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createsender/
EDIT: When we set the return_url as an empty string when creating the sender view url, the user isn't immediately redirected.