2

Request help with Postman request configuration for Docusign Authentication. Requirement is a service integration. so, first request I made to the available RestAPI is the below

https://account-d.docusign.com/oauth/auth?
response_type=code&scope=signature impersonation&
client_id=<CLIENT_ID>&redirect_uri=https://www.docusign.com

All I get back is bunch of HTML in Postman. Can anyone advise what I am doing wrong here? Also, please advise the next steps in the service integration flow to get the access token after successful authentication.

Appreciate your assistance. Many thanks in advance.

1
  • Welcome to StackOverflow!! PLEASE check (accept) the best answer for each of your questions. THANK YOU!
    – Larry K
    Aug 10, 2020 at 14:10

5 Answers 5

0

A service integration is an application without a user interface. Therefore no user and no user authentication.

Instead, the application authenticates itself and impersonates the user. This is done via the JWT grant process.

See DocuSign JWT grant docs.

I just googled for "Postman JWT grant" and didn't see anything useful.

For Postman experimentation, I'd suggest using OAuth Authorization Code grant.

Meanwhile, you asked why you received HTML when you called the URL in your question.

Answer: You should receive HTML when you call that URL since that URL is the first step in the Authorization Code grant flow. The HTML should include a form for entering your name/password.

That URL may used by the person who will be impersonated by your service application. The person would use it to grant consent to your application to impersonate them. See my post on granting consent for more information.

1
  • Thank you, @Larry K, for the inputs. I did go through the DocuSign documentation but could not comprehend how I can make service integration work. All I need is sequence of endpoint calls I can make from Postman to get authenticate to Sandbox DocuSign Environment. Thanks.
    – KAM
    Aug 10, 2020 at 17:28
0

I think you should add as well %20 instead of empty space.

"scope=signature impersonation&"

should be

"scope=signature%20impersonation&" 
2
  • Many Thanks, @IvanD. This URL is copy-pasted from Mozilla Firefox browser. For some reason, %20 is getting replaced to a normal space character in Firefox. Assure you I tested with URL encoded value.
    – KAM
    Aug 10, 2020 at 17:29
  • There are couple of points to consider before requesting JWT. First make sure your application have the consent (Manage Profile->Connected Apps). Second you don't have to use postman to get JWT consent, you can try to call DS directly from the browser as you have to provide consent. Try this "account-d.docusign.com/oauth/…" by replacing with your details and it should work.
    – IvanD
    Aug 13, 2020 at 14:14
0

We have released a new version of the Postman collection that makes it easy to use authentication. Read all about it in this detailed step-by-step blog post.

0

Please follow scope=signature%20impersonation Then use this URL in your browser without cookies, where you hardly ever uses (IE haha) Press enter. You'll see the DocuSign page login. Access using your credentials.

By doing this, DocuSign will understand the credentials used in this login may send envelopes using that Client ID.

  1. Add scope=signature%20impersonation
  2. Use a free cookie browser
  3. Give the consent.
0

I tried "rolling my own" JWT authentication, but gave up. I have found that Chilkat (chilkatsoft.com) works well:

Function Authenticate(SenderEmail2 As String) As Boolean
    'MsgBox("AuthToDocuSign.Authenticate()") 'IHF 04/28/22
    Authenticate = False
    Dim oauth2 As New Chilkat.OAuth2
    Dim success As Boolean

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 Or SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12 'IHF 05/01/22

    ' This should be the port in the localhost Redirect URI for your app defined in the Docusign developer portal.  
    ' The Redirect URI would look like "http://localhost:3017/" if the port number is 3017.
    oauth2.ListenPort = 8080
    ' For developer sandbox environment, authorization endpoint is https://account-d.docusign.com/oauth/auth
    ' For production platform, authorization endpoint is https://account.docusign.com/oauth/auth
    oauth2.AuthorizationEndpoint = "https://account.docusign.com/oauth/auth"
    oauth2.TokenEndpoint = "https://account.docusign.com/oauth/token"

    oauth2.ClientId = "c55048e7-fae1-4ad1-b223-258fce040f57" 'PROD. Also known as Integration Key
    ' This is your secret key for the authorization code grant.
    oauth2.ClientSecret = "f1ddad37-a731-44b1-9679-e7f4268ec4a2" 'PROD. Also known as Secret Key [Fix 04/28/22] ?
    oauth2.Scope = "signature"
    'oauth2.Scope = "signature impersonation" 'IHF 02/14/22
    oauth2.RedirectAllowHtml = "<html><head><meta http-equiv='refresh' content='0;url=https://app.docusign.com'></head><body>Thank you for allowing access.</body></html>" 'PROD. appdemo.docusign.com in DEV

    ' Begin the OAuth2 three-legged flow.  This returns a URL that should be loaded in a browser.
    Dim url As String = oauth2.StartAuth()
    If (oauth2.LastMethodSuccess <> True) Then
        Debug.WriteLine(oauth2.LastErrorText)
        Exit Function
    End If

    ServicePointManager.Expect100Continue = True 'IHF 02/28/22
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 'IHF 02/28/22
    Process.Start("C:\Program Files\Internet Explorer\iexplore.exe", url)

    ' Now wait for the authorization.
    ' We'll wait for a max of 30 seconds.
    Dim numMsWaited As Integer = 0
    While (numMsWaited < 30000) And (oauth2.AuthFlowState < 3)
        oauth2.SleepMs(100)
        numMsWaited = numMsWaited + 100
    End While

    ' If there was no response from the browser within 30 seconds, then 
    ' the AuthFlowState will be equal to 1 or 2.
    ' 1: Waiting for Redirect. The OAuth2 background thread is waiting to receive the redirect HTTP request from the browser.
    ' 2: Waiting for Final Response. The OAuth2 background thread is waiting for the final access token response.
    ' In that case, cancel the background task started in the call to StartAuth.
    If (oauth2.AuthFlowState < 3) Then
        oauth2.Cancel()
        Debug.WriteLine("No response from the browser!")
        Exit Function
    End If

    ' Check the AuthFlowState to see if authorization was granted, denied, or if some error occurred
    ' The possible AuthFlowState values are: 3: Completed with Success. 4: Completed with Access Denied. 5: Failed Prior to Completion.
    If (oauth2.AuthFlowState = 5) Then
        Debug.WriteLine("OAuth2 failed to complete.")
        Debug.WriteLine(oauth2.FailureInfo)
        Exit Function
    End If

    If (oauth2.AuthFlowState = 4) Then
        Debug.WriteLine("OAuth2 authorization was denied.")
        Debug.WriteLine(oauth2.AccessTokenResponse)
        Exit Function
    End If

    If (oauth2.AuthFlowState <> 3) Then
        Debug.WriteLine("Unexpected AuthFlowState:" & oauth2.AuthFlowState)
        Exit Function
    End If

    Debug.WriteLine("OAuth2 authorization granted!")
    Debug.WriteLine("Access Token = " & oauth2.AccessToken)
    accessToken = oauth2.AccessToken 'IHF 02/14/22

    ' Get the full JSON response:
    Dim json As New Chilkat.JsonObject
    json.Load(oauth2.AccessTokenResponse)
    json.EmitCompact = False
    Debug.WriteLine(json.Emit())

    ' Save the JSON to a file for future requests.
    Dim fac As New Chilkat.FileAccess
    fac.WriteEntireTextFile("qa_data/tokens/docusign.json", json.Emit(), "utf-8", False)
    Authenticate = success
End Function 'IHF 04/28/22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.