Skip to content

How to get a DocuSign access token using an authorization code

shaun-technovation edited this page Jul 25, 2024 · 4 revisions
  1. Get the DocuSign client_id (this is in 1Password)
  2. Go to this URL (be sure to add the client_id to the URL, this is the DOCUSIGN_INTEGRATION_ID ENV value):
https://account-d.docusign.com/oauth/auth?
   response_type=code
   &scope=signature%20extended
   &client_id=CLIENT_ID_HERE
   &redirect_uri=http://localhost
  1. After authenticating with DocuSign, you will be redirected to a URL that looks like this:
http://localhost/?code=SOME_CODE_HERE
  1. Copy the code from the URL and add it to the ENV named: DOCUSIGN_AUTHORIZATION_CODE
  • This code is only valid for 2 minutes
  1. Open a new Rails console and run this code to get an access token:
Docusign::Authentication.new.access_token
  • This access token is only valid for 8 hours
  1. Remove the value from: DOCUSIGN_AUTHORIZATION_CODE
  • This will force the Docusign::Authentication service to use a refresh token to obtain a new access token
  • If you have caching setup locally, the refresh token should be cached and should be used when obtaining a new access token