0
votes

I am attempting to do implement an authorization code grant I start by calling (from the browser):

https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature&client_id=1ee7dba4-ca87-4451-8b82-a5df0d95fa41&state=a39fh23hnf23&redirect_uri=http://localhost:4000/docusign/authGrantReturn/

Sometimes I am asked for login/password, which always tells me that the response type is not supported or that the user/pass are not valid. I found this previous answer (Authorization Code Grant error: invalid authentication request) but did not find the checkbox discussed.

Otherwise, it calls back my rediect url (handled in node), and provides me with a 'code' and returns the 'state' I previously sent, and here begins my confusion:

I make an http request using the fetch library like so:

let combination = `${integrationKey}:${secretKey}`;
let b64Combination = Buffer.from(combination).toString('base64');

fetch('https://account-d.docusign.com/oauth/token?grant_type:authorization_code&code='+b64Combination,{
    method: 'GET',
    headers: { 'Authorization': 'Basic ${b64Combination}', 'Content-Type': 'application/x-www-form-urlencoded',  'Content-Encoding': 'gzip'}
})
.then...

But this returns html content in the body.

  1. Does that mean I should make the call to https://account-d.docusign.com/oauth/token from the browser rather than node?

  2. When it asks me to log in, am I to use my sand-box account credentials? or the credentials of a regular docusign user?

Sorry for the confused question...

Best regards, Adrian.

1

1 Answers

0
votes

I would suggest you use the DocuSign nodeJS SDK and code example.

https://github.com/docusign/eg-03-node-auth-code-grant

Follow the instructions here, this code makes it very simple and if you update all your info - it just works. Then, you can see how to modify it to your needs. (for your second question, yes, for now you use your sandbox creds when you build/test your app)