diff options
author | Sebastian <sebasjm@gmail.com> | 2023-09-22 18:34:49 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-09-25 14:50:44 -0300 |
commit | 15af6c619de70336bcdfbabbd32b9d93aabefc5b (patch) | |
tree | 5dff83b07f9ffcb26cd4eb595f9e80f549ae25b5 /packages/demobank-ui/src/hooks/useCredentialsChecker.ts | |
parent | 5640f0a67dcc31fa2b5fa0992abca8a55bc00dd8 (diff) |
towards new core bank api
Diffstat (limited to 'packages/demobank-ui/src/hooks/useCredentialsChecker.ts')
-rw-r--r-- | packages/demobank-ui/src/hooks/useCredentialsChecker.ts | 15 |
1 files changed, 10 insertions, 5 deletions
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<LoginResult> { 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<LoginTokenSuccessResponse>(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) { |