Skip to content

Apiv2 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 36 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,77 @@
### Github repo: eg-03-python-auth-code-grant
## Introduction
This repo is a Python 3 application that demonstrates:

* Authentication with DocuSign via the
[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant).
When the token expires, the user is asked to re-authenticate.
The **refresh token** is not used in this example.
1. **Embedded Signing Ceremony.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg001_embedded_signing.py)
[Source.](./app/eg001_embedded_signing.py)
This example sends an envelope, and then uses an embedded signing ceremony for the first signer.
With embedded signing, the DocuSign signing ceremony is initiated from your website.
1. **Send an envelope with a remote (email) signer and cc recipient.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg002_signing_via_email.py)
[Source.](./app/eg002_signing_via_email.py)
The envelope includes a pdf, Word, and HTML document.
Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents.
1. **List envelopes in the user's account.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg003_list_envelopes.py)
[Source.](./app/eg003_list_envelopes.py)
The envelopes' current status is included.
1. **Get an envelope's basic information.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg004_envelope_info.py)
[Source.](./app/eg004_envelope_info.py)
The example lists the basic information about an envelope, including its overall status.
1. **List an envelope's recipients**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg005_envelope_recipients.py)
[Source.](./app/eg005_envelope_recipients.py)
Includes current recipient status.
1. **List an envelope's documents.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg006_envelope_docs.py)
[Source.](./app/eg006_envelope_docs.py)
1. **Download an envelope's documents.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg007_envelope_get_doc.py)
[Source.](./app/eg007_envelope_get_doc.py)
The example can download individual
documents, the documents concatenated together, or a zip file of the documents.
1. **Programmatically create a template.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg008_create_template.py)
[Source.](./app/eg008_create_template.py)
1. **Send an envelope using a template.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg009_use_template.py)
[Source.](./app/eg009_use_template.py)
1. **Send an envelope and upload its documents with multpart binary transfer.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg010_send_binary_docs.py)
[Source.](./app/eg010_send_binary_docs.py)
Binary transfer is 33% more efficient than using Base64 encoding.
1. **Embedded sending.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg011_embedded_sending.py)
[Source.](./app/eg011_embedded_sending.py)
Embeds the DocuSign web tool (NDSE) in your web app to finalize or update
the envelope and documents before they are sent.
1. **Embedded DocuSign web tool (NDSE).**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg012_embedded_console.py)
[Source.](./app/eg012_embedded_console.py)
1. **Embedded Signing Ceremony from a template with an added document.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg013_add_doc_to_template.py)
[Source.](./app/eg013_add_doc_to_template.py)
This example sends an envelope based on a template.
In addition to the template's document(s), the example adds an
additional document to the envelope by using the
[Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates)
feature.
1. **Payments example: an order form, with online payment by credit card.**
[Source.](https://github.com/docusign/eg-03-python-auth-code-grant/blob/master/app/eg014_collect_payment.py)
[Source.](./app/eg014_collect_payment.py)

1. **Get the envelope tab data.**
Coming soon...
1. **Set envelope tab values.**
Coming soon...
1. **Set template tab values.**
Coming soon...
1. **Get the envelope custom field data (metadata).**
Coming soon...
1. **Requiring an Access Code for a Recipient**
[Source.](./app/eg019_access_code_authentication.py)
This example sends an envelope that requires an access-code for the purpose of multi-factor authentication.
1. **Requiring SMS authentication for a recipient**
[Source.](./app/eg020_sms_authentication.py)
This example sends an envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication.
1. **Requiring Phone authentication for a recipient**
[Source.](./app/eg013_add_doc_to_template.py)
This example sends an envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication.
1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient**
[Source.](./app/eg022_kba_authentication.py)
This example sends an envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication.


## Installation

Expand Down
160 changes: 160 additions & 0 deletions app/eg019_access_code_authentication.py

Large diffs are not rendered by default.

161 changes: 161 additions & 0 deletions app/eg020_sms_authentication.py

Large diffs are not rendered by default.

161 changes: 161 additions & 0 deletions app/eg021_phone_authentication.py

Large diffs are not rendered by default.

158 changes: 158 additions & 0 deletions app/eg022_kba_authentication.py

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions app/templates/eg019_access_code_authentication.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!-- extend base layout --> {% extends "base.html" %} {% block content %}

<h4>19. Send an envelope using an Access-code for multi-factor recipient authentication</h4>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're inconsistent on "Access-code" vs. "Access Code" below. We should pick one and stick with it...


<p>This is a general example of creating and sending an envelope (a signing request) to a recipient that requires an Access Code to complete.</p>
<a href="https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience">AutoPlace</a>
is used to position the signing fields in the documents.

{% if show_doc %}
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> about this example.</p>
{% endif %}


<p>API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>

<p>
View source file <a target="_blank" href="{{ source_url | safe }}">{{ source_file }}</a> on GitHub.
</p>

<form class="eg" action="" method="post" data-busy="form">

<div class="form-group">
<label for="accessCode">Access-Code</label>
<input type="text" class="form-control" id="accessCode" name="accessCode"
aria-describedby="accessHelp" placeholder="NJ9@D1" required
value="NJ9@D1">
<small id="accessHelp" class="form-text text-muted">Send this Access-Code to the recipient to verify identity. NOTE: Access Code is NOT case sensetive</small>
</div>
<div class="form-group">
<label for="signer_email">Signer Email</label>
<input type="email" class="form-control" id="signer_email" name="signer_email"
aria-describedby="emailHelp" placeholder="pat@example.com" required
value="{{ signer_email }}">
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="signer_name">Signer Name</label>
<input type="text" class="form-control" id="signer_name" placeholder="Pat Johnson" name="signer_name"
value="{{ signer_name }}" required>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-primary">Submit</button>
</form>

{% endblock %}
49 changes: 49 additions & 0 deletions app/templates/eg020_sms_authentication.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!-- extend base layout --> {% extends "base.html" %} {% block content %}

<h4>20. Send an envelope using an Sms-code for multi-factor recipient authentication</h4>
<p> Anchor text
(<a href="https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience">AutoPlace</a>)
is used to position the signing fields in the documents.
</p>
<p>This is a general example of creating and sending an envelope (a signing request) to a recipient that requires an authorization pin sent from a text message to provide multi-factor authentication on sent envelopes.</p>

{% if show_doc %}
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> about this example.</p>
{% endif %}

<p>API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>

<p>
View source file <a target="_blank" href="{{ source_url | safe }}">{{ source_file }}</a> on GitHub.
</p>

<form class="eg" action="" method="post" data-busy="form">


<div class="form-group">
<label for="phoneNumber">SMS Number</label>
<input type="tel" class="form-control" id="phoneNumber" name="phoneNumber"
aria-describedby="accessHelp" placeholder="415-555-1212" required
value="415-555-1212">
<small id="accessHelp" class="form-text text-muted">Send a text message to this phone number to verify recipient.</small>
</div>

<div class="form-group">
<label for="signer_email">Signer Email</label>
<input type="email" class="form-control" id="signer_email" name="signer_email"
aria-describedby="emailHelp" placeholder="pat@example.com" required
value="{{ signer_email }}">
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="signer_name">Signer Name</label>
<input type="text" class="form-control" id="signer_name" placeholder="Pat Johnson" name="signer_name"
value="{{ signer_name }}" required>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-primary">Submit</button>
</form>

{% endblock %}
52 changes: 52 additions & 0 deletions app/templates/eg021_phone_authentication.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!-- extend base layout --> {% extends "base.html" %} {% block content %}

<h4>21. Send an envelope using phone-number recipient authentication</h4>
<p>Anchor text
(<a href="https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience">AutoPlace</a>)
is used to position the signing fields in the documents.
</p>
<p>This is a general example of creating and sending an envelope (a signing request) to a recipient that requires an authorization pin sent from a phone call to provide multi-factor authentication on sent envelopes.</p>

{% if show_doc %}
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> about this example.</p>
{% endif %}

<p>
The phone-number to utilize the example provided is: <strong>415-555-1212</strong>
</p>

<p>API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>

<p>
View source file <a target="_blank" href="{{ source_url | safe }}">{{ source_file }}</a> on GitHub.
</p>

<form class="eg" action="" method="post" data-busy="form">


<div class="form-group">
<label for="phoneNumber">Phone Number</label>
<input type="tel" class="form-control" id="phoneNumber" name="phoneNumber"
aria-describedby="accessHelp" placeholder="415-555-1212" required
value="415-555-1212">
<small id="accessHelp" class="form-text text-muted">Send a phone call to this number to verify recipient.</small>
</div>
<div class="form-group">
<label for="signer_email">Signer Email</label>
<input type="email" class="form-control" id="signer_email" name="signer_email"
aria-describedby="emailHelp" placeholder="pat@example.com" required
value="{{ signer_email }}">
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="signer_name">Signer Name</label>
<input type="text" class="form-control" id="signer_name" placeholder="Pat Johnson" name="signer_name"
value="{{ signer_name }}" required>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-primary">Submit</button>
</form>

{% endblock %}
40 changes: 40 additions & 0 deletions app/templates/eg022_kba_authentication.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- extend base layout --> {% extends "base.html" %} {% block content %}

<h4>22. Send an envelope using a Knowledge Based Authentication for multi-factor recipient authentication</h4>
<p>Anchor text
(<a href="https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience">AutoPlace</a>)
is used to position the signing fields in the documents.
</p>
<p>This is a general example of creating and sending an envelope (a signing request) to a recipient that requires answers for top-of-the-mind questions generated from public records to provide multi-factor authentication on sent envelopes.</p>

{% if show_doc %}
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> about this example.</p>
{% endif %}


<p>API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>

<p>
View source file <a target="_blank" href="{{ source_url | safe }}">{{ source_file }}</a> on GitHub.
</p>

<form class="eg" action="" method="post" data-busy="form">
<div class="form-group">
<label for="signer_email">Signer Email</label>
<input type="email" class="form-control" id="signer_email" name="signer_email"
aria-describedby="emailHelp" placeholder="pat@example.com" required
value="{{ signer_email }}">
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="signer_name">Signer Name</label>
<input type="text" class="form-control" id="signer_name" placeholder="Pat Johnson" name="signer_name"
value="{{ signer_name }}" required>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-primary">Submit</button>
</form>

{% endblock %}
67 changes: 67 additions & 0 deletions app/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,73 @@ <h4 id="example014">14. <a href="eg014">Send an envelope with an order form and
<p>API method used:
<a target ='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>


<h2>Tabs Examples</h2>
<h4 id="example015">15. <a href="#">Get the tab data from an envelope</a></h4>
<p>Comming Soon...</p>
<p>
</p>

<h4 id="example016">16. <a href="#">Set tab values for a envelope</a></h4>
<p>Comming Soon...</p>
<p>
</p>

<h4 id="example017">17. <a href="#">Set template tab values</a></h4>
<p>Comming Soon...</p>
<p>
</p>

<h4 id="example018">18. <a href="#">List envelope custom metadata field values</a></h4>
<p>Comming Soon...</p>
<p>
</p>


<h2>Recipient Authentication</h2>
<h4 id="example019">19. <a href="eg019">Send an envelope with Access Code Recipient Authentication</a></h4>

<p>
Submit an envelope with an access code for multi-factor authentication.
</p>
<p>
API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>

<h4 id="example020">20. <a href="eg020">Send an envelope with SMS Recipient Authentication</a></h4>


<p>
Submit an envelope with a text message for multi-factor authentication.
</p>
<p>
API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>

<h4 id="example021">21. <a href="eg021">Send an envelope with Phone Recipient Authentication</a></h4>

<p>
Submit an envelope with a voice call to provide multi-factor authentication.
</p>
<p>
API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>

<h4 id="example022">22. <a href="eg022">Send an envelope with Recipient Knowledged Based Authentication</a></h4>

<p>
Submit an envelope with multiple choice, public records based questions to provide multi-factor authentication.
</p>
<p>
API method used:
<a target='_blank' href="https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create">Envelopes::create</a>.
</p>


</div>

<!-- anchor-js is only for the index page -->
Expand Down
25 changes: 24 additions & 1 deletion app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
eg008_create_template, eg009_use_template, \
eg010_send_binary_docs, eg011_embedded_sending, \
eg012_embedded_console, eg013_add_doc_to_template, \
eg014_collect_payment
eg014_collect_payment, eg019_access_code_authentication, \
eg020_sms_authentication, eg021_phone_authentication, \
eg022_kba_authentication


@app.route('/')
Expand Down Expand Up @@ -99,6 +101,27 @@ def eg013():
def eg014():
return eg014_collect_payment.controller()

@app.route('/eg019', methods=['GET', 'POST'])
def eg019():
return eg019_access_code_authentication.controller()



@app.route('/eg020', methods=['GET', 'POST'])
def eg020():
return eg020_sms_authentication.controller()


@app.route('/eg021', methods=['GET', 'POST'])
def eg021():
return eg021_phone_authentication.controller()


@app.route('/eg022', methods=['GET', 'POST'])
def eg022():
return eg022_kba_authentication.controller()



@app.route('/ds_return')
def ds_return():
Expand Down
Loading