taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit e9193c4708b3aee54457278cf19b5840e4d8b3d5
parent 0b413324524a9cc0165addbc429681091e60f8e9
Author: Florian Dold <dold@taler.net>
Date:   Tue, 21 Jul 2026 03:03:45 +0200

util: fetch the access-token list from the authenticated /tokens endpoint

getAccessTokenList requested the singular /token path (defined only for POST and
DELETE) and sent no Authorization header. Request the plural /tokens with a
bearer token, and surface the documented 401 and 403 as known failures.

Diffstat:
Mpackages/taler-util/src/http-client/bank-core.ts | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/packages/taler-util/src/http-client/bank-core.ts b/packages/taler-util/src/http-client/bank-core.ts @@ -242,18 +242,29 @@ export class TalerCoreBankHttpClient { */ async getAccessTokenList( user: string, + token: AccessToken, pagination?: PaginationParams, - ): Promise<OperationOk<TokenInfos>> { - const url = new URL(`accounts/${pathSegment(user)}/token`, this.baseUrl); + ): Promise< + | OperationOk<TokenInfos> + | OperationFail<HttpStatusCode.Unauthorized | HttpStatusCode.Forbidden> + > { + const url = new URL(`accounts/${pathSegment(user)}/tokens`, this.baseUrl); addPaginationParams(url, pagination); const resp = await this.httpLib.fetch(url.href, { method: "GET", + headers: { + Authorization: makeBearerTokenAuthHeader(token), + }, }); switch (resp.status) { case HttpStatusCode.Ok: return opSuccessFromHttp(resp, codecForTokenInfoList()); case HttpStatusCode.NoContent: return opFixedSuccess(resp, { tokens: [] }); + case HttpStatusCode.Unauthorized: + return opKnownHttpFailure(resp.status, resp); + case HttpStatusCode.Forbidden: + return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.NotFound: return opFixedSuccess(resp, { tokens: [] }); default: