# Error loading settings file after ading adminAuth

**URL:** https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452
**Category:** General
**Tags:** security
**Created:** [4 June 2022 12:40 UTC](https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452 "2022-06-04T12:40:42Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![CBianca](https://avatars.discourse-cdn.com/v4/letter/c/d2c977/32.png) [@CBianca](https://discourse.nodered.org/u/CBianca)
#### Post date: [4 June 2022 12:40 UTC](https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452/1 "2022-06-04T12:40:42Z")

</div>

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:

```auto
    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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/490ca28a8a6ed71313bef2250446ec95a377a009.png)

What can be the caused?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [4 June 2022 14:15 UTC](https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452/2 "2022-06-04T14:15:59Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![CBianca](https://avatars.discourse-cdn.com/v4/letter/c/d2c977/32.png) [@CBianca](https://discourse.nodered.org/u/CBianca)
#### Post date: [4 June 2022 14:29 UTC](https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452/3 "2022-06-04T14:29:54Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b4d8c48005a17110ccc4a06b604b51db25fb1365.png)

---

<div class="post-metadata">

### Author: ![CBianca](https://avatars.discourse-cdn.com/v4/letter/c/d2c977/32.png) [@CBianca](https://discourse.nodered.org/u/CBianca)
#### Post date: [4 June 2022 14:35 UTC](https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452/4 "2022-06-04T14:35:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [4 June 2022 14:46 UTC](https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452/5 "2022-06-04T14:46:28Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [18 June 2022 14:47 UTC](https://discourse.nodered.org/t/error-loading-settings-file-after-ading-adminauth/63452/6 "2022-06-18T14:47:11Z")

</div>

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