docusign / OpenAPI-Specifications

The official Docusign REST APIs Swagger Specifications
MIT License
19 stars 15 forks source link

ApiClient object missing #35

Open code4ghana opened 3 years ago

code4ghana commented 3 years ago

Hello,

It appears the ApiClient object is missing from the definitions.

More Specifically because swagger doesn't contain the ApiClient object, I don't see any actual way of authenticating the requests via the API.

The documentation calls for

` import * as docusign from 'docusign-esign';

const apiClient = new docusign.ApiClient(); // ApiClient doesn't exist // use jwt authentication through apiClient object `

I'm following the logic in your auto-generated Quickstart project for nodejs, the corresponding code location is on github. Is there a new way to authenticate? If not could you help fix this? thanks!

LarryKlugerDS commented 3 years ago

Hi @code4ghana , The Swagger file includes the specification for the eSignature REST API itself. The ApiClient is how the SDKs keep track of the baseUrl and other information.

To obtain an access_token for the API, create a client_id (what DocuSign calls an integration key), and then use Authorization Code, Implicit, or JWT grant to get an access token.

Include the access token with each API call in an Authorization header.

See https://developers.docusign.com/platform/auth/choose/

code4ghana commented 3 years ago

Hey @LarryKlugerDS

thanks for the response! The ApiClient class also has methods that help with the jwt flow for you, so it was useful being able to abstract the auth-dance to it. The demo code explicitly uses that object so I was just surprised when I could not find it, perhaps the demo could be updated to not use it since it's not meant to be be used.

Most of this was prompted by me wanting to use typescript so I : 1) npm i docusign-esign 2) npm i @types/docusign-esign 3) Getting missing/undefined object errors (e.g. EnvelopeDefinition) and realizing that the two libraries are out of sync (I believe the types library is out of date). 4) Decided to regen the newest types with Swagger, which lead to its own rabbit-hole.

My issue is solved, but I'll leave this bug open for you to decide whether any tasks should come out of it!

thanks again!