Error loading settings file after ading adminAuth

Hello guys,
I am trying to create an OAuth/OpenID based authentication with the help of keycloak.

For that I have used the following adminAuth:

    adminAuth: {
        type: "strategy",
        strategy: {
            name: "Keycloak",
            label: 'Sign in with KeyCloak',
            icon: "fa-key",
            strategy: require("@exlinc/keycloak-passport"),
            options: {
                host: "https://localhost:1881",
                realm: "master",
                clientID: "account",
                clientSecret: "theSecret",
                callbackURL: "/auth/strategy/callback",
                authorizationURL: "https://localhost:8080/auth/realms/master/protocol/openid-connect/auth",
                tokenURL: "https://localhost:8080/auth/realms/master/protocol/openid-connect/token",
                userInfoURL: "https://localhost:8080/auth/realms/master/protocol/openid-connect/userinfo"
            },
            verify: function (accessToken, refreshToken, profile, done) {
                done(null, profile);
            }
        },
        users: [
            { username: "me@example.com", permissions: ["*"] }
        ]
    },

The problem: When I try to get the server running I get the following message:

Error loading settings file: C:\Users\bianca.cernat.node-red-1881\settings.js

Also trying to debug, but this command gives no output
image

What can be the caused?

Can't see an error in that snippet of code so likely to be elsewhere in the file. Maybe run it through eslint to see if that spots the issue?

Ok so i run both of my settings.js files: first one from node-red-1880 is working, the server cat start and run normally but the second one, from node-red-1881 is not. So I guess the problem is with "require" since this is the only difference.
I loked at the documentation and saw that this is how strategy: should be written so.....

image

I used npm to install passport and @exlinc/keycloak-passport and the server is up

You should set a .eslintrc.js in the root of your userDir folder and tell eslint that you are using node.js. You might also want to tell it what version of ECMA it should validate for.

JavaScript Versions
 *  5 is minimum -> Last IE11
 *  6 = 2015 -> Node >8.10, iOS12+
 *  7 = 2016 -> FF78+, 
 *  8 = 2017 -> Node 10.9+
 *  9 = 2018 -> Node 12.11+
 * 10 = 2019 -> Node 12.20 LTS
 * 11 = 2020 -> Node 14 LTS
 * 12 = 2021 -> Node 16

Though I am just in a discussion with the eslint devs because they do not correctly recognise some Node.js v12 features and output an untrappable error that isn't needed.

But anyway, adding the config makes it easier to check the code.

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