Error while implementing login with keycloak

Hello guys, I am trying to fix this for 4 hours now so I really hope you can help me...

I am using keycloak as an Identity Provider to acces my editor.
I modified my settings.js file as described in this post here.

   adminAuth: {
        type: "strategy",
        strategy: {
            name: "keycloak",
            label: 'Sign in',
            icon: "fa-lock",
            strategy: require("passport-keycloak-oauth2-oidc").Strategy,
            options: {
                clientID: "account",
                realm: 'master',
                publicClient: "false",
                clientSecret: "deleted",
                sslRequired: "none",
                authServerURL: "http://localhost:8080/auth",
                callbackURL: "http://localhost:1881/auth/strategy/callback",
                verify: function (token, tokenSecret, profile, done) {
                    done(null, profile);
        users: [
            { username: "user", permissions: ["*"] }

My keycloak configurations are:
Realm name: master
Client config:

When I go to my app on localhost:8080 and click Sign in I get the following error:

What I am doing wrong, I tried multiple changing the authServerURL and callbackURL 100 times but no success.

Thank you!

Have you installed passport and passport-keycloak-oauth2-oidc using npm?

You may need to show the entire error message that is in that box - there are probably clues there.

I don't think it's even reaching out to Keycloak but I will also note that master realm is not recommended to use for anything but Keycloak administration, and I would definitely recommend to create a Client specifically for Node-RED so that you're not re-using credentials for different services and you can provide the specific redirect URI that you need to allow.

Yes, I have installed them with npm.

The error:


URL Decoded...

InternalOAuthError: Failed to obtain access token (status: 404 data: <!DOCTYPE html>
<html><head><title>Not Found</title></head>
<h2>Access Error: 404 -- Not Found</h2>
<pre>Cannot open document for: /auth/realms/master/protocol/openid-connect/token</pre>

Does that help?

It helps partially….

Still can’t find any solution

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.