The CORS Sample App is a Docusign sample application that shows how to construct Single Page Applications (SPAs) that leverage Docusign support for Cross-Origin Resource Sharing (CORS). This sample application is created using React.js. You can find a live instance running at https://cors.sampleapps.docusign.com/.
The CORS Sample App demonstrates the following:
- Authentication with Docusign via Implicit Grant.
- Send Insurance Card: This example uses the Docusign eSignature REST API to request a signature by email with Document Generation using a predefined template in docx format.
- Know Your Customer: This example uses the Docusign eSignature REST API to request a signature through your application using Embedded Signing.
-
Create a Docusign Developer Account.
-
Create an application on the Apps and Keys page.
-
Set Authentication Method for your application to Implicit Grant. Under User Application: Is your application able to securely store a client secret, select No.
-
Add redirect URIs:
{ PROTOCOL }://{ DOMAIN }/
{ PROTOCOL }://{ DOMAIN }/oauth-response-handler/
{ PROTOCOL }://{ DOMAIN }/ds-response-handler/
-
Update CORS Configuration:
- Origin URLs:
{ PROTOCOL }://{ DOMAIN }
- Allowed HTTP Methods: GET, POST, PUT
- Origin URLs:
-
Installed and configured Node.js
-
Installed and configured Docker
Create a copy of the file .env.example, save the copy as .env, and fill in the data:
- REACT_APP_OAUTH_CLIENT_ID - integration key of the application created in section "Create an application on the Apps and Keys page" above (GUID)
- REACT_APP_OAUTH_RETURN_URL - internal redirection URL that is used during the authentication
- REACT_APP_DS_RETURN_URL - internal redirection URL that is used during the enbedded signing process
-
Clone the git repository to your local machine.
-
Open a terminal in /sample-app-mycors-javascript directory.
-
Install required application packages runing the following command in the terminal:
npm install
-
Start the application runing the following command in the terminal:
npm start
-
Open a browser to localhost:3000 (if the page is not openned automatically after step #4).
-
Clone the git repository to your local machine.
-
Open a terminal in /sample-app-mycors-javascript directory.
-
Build the docker image runing the following command in the terminal:
docker build -t docusign_sample_mycors .
-
Start the application (run the Docker container) with the following command in the terminal:
docker run -p 80:80 -d docusign_sample_mycors
-
Open a browser to localhost
This repository uses the MIT License. See the LICENSE file for more information.