Skip to content

Commit 0732c77

Browse files
committed
updates to homepage and readme and minor comment changes for config file
1 parent 5a480a0 commit 0732c77

3 files changed

Lines changed: 38 additions & 23 deletions

File tree

README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
# Python: Authorization Code Grant Examples
1+
# Python Launcher Code Examples
22

3-
### Github repo: eg-03-python-auth-code-grant
3+
### Github repo: [code-examples-python](./)
44
## Introduction
55
This repo is a Python 3 application that demonstrates:
66

7-
* Authentication with DocuSign via the
8-
[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant).
9-
When the token expires, the user is asked to re-authenticate.
10-
The **refresh token** is not used in this example.
11-
* Authentication with DocuSign via the [JSON Web Token (JWT) Grant](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-jsonwebtoken).
12-
When the token expires, it updates automatically.
7+
138
1. **Embedded Signing Ceremony.**
149
[Source.](./app/examples/eg001_embedded_signing/controller.py)
1510
This example sends an envelope, and then uses an embedded signing ceremony for the first signer.
@@ -119,14 +114,23 @@ When the token expires, it updates automatically.
119114
Firstly, creates a bulk send recipients list, and then creates an envelope.
120115
After that, initiates bulk envelope sending.
121116

117+
118+
## Included OAuth grant types:
119+
120+
* Authentication with Docusign via [Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant) .
121+
When the token expires, the user is asked to re-authenticate.
122+
The **refresh token** is not used in this example.
123+
124+
* Authentication with DocuSign via the [JSON Web Token (JWT) Grant](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-jsonwebtoken).
125+
When the token expires, it updates automatically.
126+
127+
122128
## Installation
123129

124130
### Prerequisites
125131
1. A DocuSign Developer Sandbox account (email and password) on [demo.docusign.net](https://demo.docusign.net).
126132
Create a [free account](https://go.docusign.com/sandbox/productshot/?elqCampaignId=16535).
127-
1. A DocuSign Integration Key (a client ID) that is configured to use the
128-
OAuth Authorization Code flow.
129-
You will need the **Integration Key** itself, and its **secret**.
133+
1. A DocuSign Integration Key (a client ID). To use Authorization code grant, you will need the **Integration Key** itself, and its **secret**. To use Json Web token, you will need the **Integration Key** itself, the **RSA Secret Key** and an API user ID for the user you are impersonating.
130134

131135
If you use this example on your own workstation,
132136
the Integration key must include a **Redirect URI** of `http://localhost:5000/ds/callback`
@@ -154,9 +158,20 @@ When the token expires, it updates automatically.
154158
should ensure that ds_config.py file will not be stored in your source code
155159
repository.
156160

157-
1. **python3 run.py**
161+
1. **python run.py**
158162
1. Open a browser to **http://localhost:5000**
159163

164+
### Configuring JWT
165+
166+
1. Create a developer sandbox account on developers.docusign.com if you don't already have one.
167+
2. Create a new API key in the Admin panel: https://admindemo.docusign.com/api-integrator-key, take note of the public key.
168+
3. Set a redirect URI of `http://localhost:5000/ds/callback` as mentioned in the installation steps above for the API key you make in step 2.
169+
4. Generate an RSA keypair in the administrator console on the DocuSign developer sandbox and copy the private key to a secure location.
170+
5. Create a new file in your repo source folder named **private.key**, and paste in that copied RSA private key, then save it.
171+
6. Update the file **app/ds_config.py** and include the newly created API key from step 2 as well as your account user id GUID which is also found on the Admin panel: `https://admindemo.docusign.com/api-integrator-key`.
172+
173+
From there you should be able to run the launcher using **python run.py** then selecting **Json Web Token** when authenticaing your account.
174+
160175
#### Payments code example
161176
To use the payments example, create a
162177
test payments gateway for your developer sandbox account.
@@ -167,18 +182,20 @@ file for instructions.
167182

168183
Then add the payment gateway account id to the **app/ds_config.py** file.
169184

170-
## Using the examples with other authentication flows
171185

172-
The examples in this repository can also be used with either the
173-
Implicit Grant or JWT OAuth flows.
174-
See the [Authentication guide](https://developers.docusign.com/esign-rest-api/guides/authentication)
175-
for information on choosing the right authentication flow for your application.
176186

177187
## License and additional information
178188

189+
### Implicit Grant
190+
191+
The examples in this repository can also be used the
192+
Implicit Grant OAuth flow.
193+
See the [Authentication guide](https://developers.docusign.com/esign-rest-api/guides/authentication)
194+
for information on choosing the right authentication flow for your application.
195+
179196
### License
180197
This repository uses the MIT License. See the LICENSE file for more information.
181198

182199
### Pull Requests
183200
Pull requests are welcomed. Pull requests will only be considered if their content
184-
uses the MIT License.
201+
uses the MIT License.

app/ds_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
DS_JWT = {
3131
"ds_client_id": "{CLIENT_ID}",
3232
"ds_impersonated_user_id": "{IMPERSONATED_USER_ID}", # the id of the user
33-
"private_key_file": "private.key", # path to file which hold private key or private key itself
33+
"private_key_file": "./private.key", # create a new file named private.key in the app directory
3434
"authorization_server": "account-d.docusign.com",
3535
}

app/templates/home.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
<!-- IF not signed in -->
88
<div class="jumbotron">
99
<h1 class="display-4">Welcome!</h1>
10-
<p class="Xlead">Welcome to the DocuSign Python code examples with
11-
OAuth Authorization Code Grant.</p>
10+
<p class="Xlead">Welcome to the DocuSign eSignature Python code examples.</p>
1211
</div>
1312
{% endif %}
1413

@@ -18,8 +17,7 @@ <h1 class="display-4">Welcome!</h1>
1817

1918
<div id="index-page">
2019
<h2>Welcome</h2>
21-
<p>This launcher both demonstrates use of the OAuth Authorization Code Grant flow and includes multiple
22-
usage examples for the DocuSign eSignature REST API.</p>
20+
<p>This launcher includes the following examples for the DocuSign eSignature REST API.</p>
2321

2422
{% if show_doc %}
2523
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a> on using OAuth Authorization Code Grant from a

0 commit comments

Comments
 (0)