keycloak-nodejs-admin-client icon indicating copy to clipboard operation
keycloak-nodejs-admin-client copied to clipboard

Wrong api call in auth .

Open biswassampad opened this issue 3 years ago • 2 comments

Describe the bug

There is a wrong API call in auth function which is basically {{localhost}}/auth/{{realmName}}/myrealm/protocol/openid-connect/token but it should be {{localhost}}/realms/{{realmName}}/protocol/openid-connect/token .

Version

18.0.1

Expected behavior

The API call from axios during auth request should be {{localhost}}/realms/{{realmName}}/protocol/openid-connect/token

Actual behavior

The API call from axios during auth request is {{localhost}}/auth/realms/{{realmName}}/protocol/openid-connect/token

How to Reproduce?

Install dockerize keycloack version 18.0.1 and try to create a node client with keycloack-nodejs-admin-client 18.0.2. and paste the code below.

import KcAdminClient from '@keycloak/keycloak-admin-client'; const kcAdminClient = new KcAdminClient.default();

try{ await kcAdminClient.auth({ username:'myuser', password:'123456789', grantType:"password", clientId:"test-client", }); }catch(er){ console.log(er); }

then run with node index.js to check the result

Anything else?

No response

biswassampad avatar Jun 28 '22 18:06 biswassampad

I also think that this is a bug. For now you can workaround this by overwriting the baseUrl:

const kcAdminClient = new KcAdminClient.default({
    baseUrl: 'http://localhost:8080/'
});

kemalk89 avatar Jul 11 '22 07:07 kemalk89

Any updates on this? It looks like the /well-known/uma2-configuration endpoint is also called with /auth but should be called without it.

tschannik avatar Jul 19 '22 13:07 tschannik