mittwald/api-client-js

withAccessToken: allow dynamic tokens

开放

#46 创建于 2024年3月20日

 (0 条评论) (0 个反应) (0 位负责人)TypeScript (0 个派生)auto 404
enhancementgood first issue

仓库指标

星标
 (2 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

https://github.com/mittwald/api-client-js/pull/45 introduced the common interceptor withAccessToken.

If changing the access-token at runtime should be supported (what I suppose is a real-world-use-case), the withAccessToken interceptor is not the right solution, because it would require to create a new client and replace all usages.

Maybe the token parameter could be a function (executed in the interceptor) or a variable bag { token: string } what can be mutated during runtime – but this is a not so common and reasonable approach.

贡献者指南