docusign-esign-node-client icon indicating copy to clipboard operation
docusign-esign-node-client copied to clipboard

Enhancement: Make Use of ApiClient.applyAuthToRequest

Open andercs opened this issue 2 years ago • 1 comments

Right now, there's some pretty cool generic logic setup for applying the appropriate headers to various ApiClient requests automatically via the ApiClient.applyAuthToRequest function; however, the auth object that it tries to make use of to set the appropriate authentication header never has any fields other than type.

It would be nice if we could set the corresponding fields on an API Client, e.g. dsApiClient.setJWTToken(jwtToken), which would set the appropriate field on the corresponding auth object, so that when we make DocuSign API requests, it automatically adds the appropriate auth header.

Presently, we have to do that bit manually by doing something like dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken), which works, but that is an API implementation detail that could be abstracted away by the SDK.

andercs avatar Aug 01 '22 23:08 andercs

@andercs Thanks for sharing this recommendation. We have made a note of it to consider as we continue to update our SDKs

jglassenberg avatar Aug 11 '22 22:08 jglassenberg