From 15af6c619de70336bcdfbabbd32b9d93aabefc5b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 22 Sep 2023 18:34:49 -0300 Subject: towards new core bank api --- packages/demobank-ui/src/hooks/useCredentialsChecker.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'packages/demobank-ui/src/hooks/useCredentialsChecker.ts') diff --git a/packages/demobank-ui/src/hooks/useCredentialsChecker.ts b/packages/demobank-ui/src/hooks/useCredentialsChecker.ts index b76754ffe..05954348f 100644 --- a/packages/demobank-ui/src/hooks/useCredentialsChecker.ts +++ b/packages/demobank-ui/src/hooks/useCredentialsChecker.ts @@ -9,20 +9,25 @@ export function useCredentialsChecker() { //while merchant backend doesn't have a login endpoint async function requestNewLoginToken( username: string, - password: AccessToken, + password: string, ): Promise { const data: LoginTokenRequest = { - scope: "write", + scope: "readwrite" as "write", //FIX: different than merchant duration: { - d_us: "forever" + // d_us: "forever" //FIX: should return shortest + d_us: 1000 * 60 * 60 * 23 }, refreshable: true, } try { const response = await request(baseUrl, `accounts/${username}/token`, { method: "POST", - token: password, - data + basicAuth: { + username: username, + password, + }, + data, + contentType: "json" }); return { valid: true, token: response.data.token, expiration: response.data.expiration }; } catch (error) { -- cgit v1.2.3