Hello all,
I’m struggling trying to configure Strapi v4 to authenticate and save user info into users model using keycloak.
I followed this tutorial : Add a Custom OAuth2/OpenID Connect Provider to Strapi v4 but still getting the following error:
Error: connect ECONNREFUSED 127.0.0.1:80
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 80
}
TypeError: Cannot read properties of undefined (reading 'email')
at Object.connect (/home/alexandre.odoni/dev/cmc/strapi-escola/node_modules/@strapi/plugin-users-permissions/server/services/providers.js:56:37)
below my providers-registry.js code:
async keycloak({ accessToken }) {
console.log('KEYCLOAK')
const keycloak = purest({
provider: 'keycloak',
config: {
keycloak: {
'https://lemur-4.cloud-iam.com/auth/realms/keycloak-test': {
__domain: {
auth: {
auth: { bearer: '[0]' },
},
},
'{endpoint}': {
__path: {
alias: '__default',
},
},
},
},
},
});
try {
const all = await keycloak
.get('userinfo')
.auth(accessToken)
.request();
} catch (err) {
console.log(err);
}
Any clues ?
Regards,