Getting an authentication token using the Bash Quickstart

Sometimes you have an idea or you want to test something really quick. You just need to write some fast and dirty code and you don't want to take the time to set up a whole integration project; the thing holding you back is that you need an authentication token before you can get your test code to work.

You could write an app just to get an OAuth 2.0 token, which is a great solution; but fortunately, there's another way. This is where DocuSign Quickstart comes in.

Note: These authentication tokens expire eight hours after they are issued and can only be used in the developer environment, they cannot be used for running real integration code in production.

What is Quickstart?

DocuSign Quickstart is a wizard that generates a template application in your choice of Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby, that is preconfigured with your account settings and all required authentication code. It contains everything that you need to start developing DocuSign integrations.

Quickstart projects contain code examples you can run that correspond to code in our How-to guides.

Why Quickstart?

Quickstart projects are easy to set up and use. In just a few minutes you can download and run DocuSign launchers in the programming language of your choice that contain authentication code and DocuSign code examples. All you need to get started is a DocuSign developer account. Well… you'll also need a Bash terminal to run the Bash launcher. I use the one that comes with VS Code.

Read the DocuSign Quickstart overview to learn more. You can also watch our How to Download Quickstart Demo to help you get started.

Why Bash?

It seems like a strange choice, right? Well, it turns out that, once downloaded, set up, and run, the Bash launcher will request an authentication token that you can use to develop your apps!

After entering bash launcher.sh from a command line in your project directory,  you're prompted to choose which DocuSign API examples you want to run:

DocuSign Code Example Launcher for Bash, opening screen

And then asked to choose an authorization type (either Authorization Code Grant or JSON Web Token).

DocuSign Code Example Launcher for Bash, selecting auth method

After you log in, you're prompted to click Accept. The launcher will request an access token with a set of scopes necessary to run code examples of the selected DocuSign API: for example, eSignature.

DocuSign authentication prompt

Okay… Where's my token?

The access token is then written to a file in your Bash launcher project in the config directory, from which you can copy and paste the token to use in your code. The token will be valid for 8 hours.

In the same directory you will also find a file called private.key that you can use to authenticate using JWT.

Finding your token in the Bash code launcher project

Now you're ready to code!

Additional resources 

Robert Knight
Author
Robert Knight
Sr. Programmer Writer
Published