mittwald/api-client-js

withAccessToken: allow dynamic tokens

Ouverte

#46 ouverte le 20 mars 2024

 (0 commentaire) (0 réaction) (0 personne assignée)TypeScript (0 fork)auto 404
enhancementgood first issue

Métriques du dépôt

Stars
 (2 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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.

Guide contributeur