webflow / js-webflow-api

Node.js SDK for the Webflow Data API
https://www.npmjs.com/package/webflow-api
296 stars 95 forks source link

Update Token does not set underlying axios auth #110

Closed deldrid1 closed 6 months ago

deldrid1 commented 1 year ago

Per the docs, you should be able to set the token after initialization to anything you want: https://github.com/webflow/js-webflow-api#update-token

Unfortunately, the setter only updates this.options, and fails to update the underlying axios this.client. this.options are not referenced by the methods recommended for v2 API, and only this.client is used, so no Authorization header is included in the requests... :/

The axios this.client.config needs to be updated when the token is updated or the individual get, post, etc. methods need to be updated to use this.options with every request.

https://github.com/webflow/js-webflow-api/blob/9ad49c088da890d66e4ca1971d695e0548c4adbb/src/core/webflow.ts#L119C21-L119C21

dsinghvi commented 6 months ago

This is no longer relevant in the v2.2.0 release, please reopen if you encounter anymore issues!