-
Notifications
You must be signed in to change notification settings - Fork 4
How to get a DocuSign access token using an authorization code
shaun-technovation edited this page Jul 25, 2024
·
4 revisions
- Get the DocuSign
client_id
(this is in 1Password) - Go to this URL (be sure to add the
client_id
to the URL, this is theDOCUSIGN_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
- After authenticating with DocuSign, you will be redirected to a URL that looks like this:
http://localhost/?code=SOME_CODE_HERE
- Copy the
code
from the URL and add it to the ENV named:DOCUSIGN_AUTHORIZATION_CODE
- This
code
is only valid for 2 minutes
- 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
- 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