# How to pass --ui-jwt-secret argument to supply the secret key used for signing browser cookies?

**URL:** <https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754>\
**Category:** Uncategorized\
**Created:** [June 3, 2021, 9:34am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754 "2021-06-03T09:34:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![VincentWang](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@VincentWang](https://forum.genieacs.com/u/VincentWang)\
**Post date:** [June 3, 2021, 9:34am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/1 "2021-06-03T09:34:18Z")

</div>

Hi everyone,  
I am totally new in genieacs.  
This is my first time to install genieacs.  
I have a question about genieacs UI.

# From [genieacs/README.md at master · genieacs/genieacs · GitHub](https://github.com/genieacs/genieacs/blob/master/README.md)

genieacs-ui

This serves the web based user interface. It listens on port 3000 by default. You must pass --ui-jwt-secret argument to supply the secret key used for signing browser cookies:

# genieacs-ui --ui-jwt-secret secret The UI has plenty of configuration options. When you open GenieACS’s UI in a browser you’ll be greeted with a database initialization wizard to help you populate some initial configuration.

My question is how to get the secret key?  
And how to pass it to browser?  
Many thanks!

---

<div class="post-metadata">

**Author:** ![lavira](https://avatars.discourse-cdn.com/v4/letter/l/87869e/32.png) [@lavira](https://forum.genieacs.com/u/lavira)\
**Post date:** [June 3, 2021, 11:55am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/2 "2021-06-03T11:55:10Z")

</div>

Hi,  
the UI\_JWT\_SECRET must be passed to the genieacs-ui process as a environment variable, so if you configured the process to run as a systemd service, you must add this line to the environment file configured:

```auto
GENIEACS_UI_JWT_SECRET=<insert_random_string_here>

```

---

<div class="post-metadata">

**Author:** ![VincentWang](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@VincentWang](https://forum.genieacs.com/u/VincentWang)\
**Post date:** [June 4, 2021, 8:03am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/3 "2021-06-04T08:03:46Z")

</div>

Hi Lavira,  
Many many thanks for your answer. 🙂  
Now my environment variable in /opt/genieacs/genieacs.env is  
GENIEACS\_UI\_JWT\_SECRET=secret

Do you mean I should change it to  
GENIEACS\_UI\_JWT\_SECRET=\<random\_string\> ?  
Where should I get this random string?

Thanks for your help!  
Vincent

---

<div class="post-metadata">

**Author:** ![VincentWang](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@VincentWang](https://forum.genieacs.com/u/VincentWang)\
**Post date:** [June 4, 2021, 9:04am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/4 "2021-06-04T09:04:17Z")

</div>

Hi Lavira,  
Can you help to check my steps:

1. I try to online create a JWR\_SECRET from [https://www.javainuse.com/jwtgenerator](https://www.javainuse.com/jwtgenerator)
2. Then I get the key as  
eyJhbGciOiJIUzI1NiJ9.eyJVc2VybmFtZSI6IkphdmFJblVzZSJ9.Cak4ou7W9ndNFTc-4JxXQcBw3jbhxa7ve34JHFHh8K0
3. Then I update /opt/genieacs/genieacs.env as  
GENIEACS\_UI\_JWT\_SECRET=eyJhbGciOiJIUzI1NiJ9.eyJVc2VybmFtZSI6IkphdmFJblVzZSJ9.Cak4ou7W9ndNFTc-4JxXQcBw3jbhxa7ve34JHFHh8K0
4. Restart genieacs-ui service
5. From browser, input http://\<GENIEACS\_UI\_INERFACE\>:3000  
But still get “This site can’t be reached”

Thanks!

---

<div class="post-metadata">

**Author:** ![lavira](https://avatars.discourse-cdn.com/v4/letter/l/87869e/32.png) [@lavira](https://forum.genieacs.com/u/lavira)\
**Post date:** [June 4, 2021, 10:03am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/5 "2021-06-04T10:03:59Z")

</div>

In order for the UI to work, you also need the other UI related config in that genieacs.env file:

```auto
GENIEACS_UI_INTERFACE=0.0.0.0
GENIEACS_UI_PORT=3000

```

do you have these? If yes, what’s the output of the following command?

```auto
systemctl status genieacs-ui.service

```

---

<div class="post-metadata">

**Author:** ![VincentWang](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@VincentWang](https://forum.genieacs.com/u/VincentWang)\
**Post date:** [June 7, 2021, 5:50am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/6 "2021-06-07T05:50:21Z")

</div>

Hi Lavira,  
Thanks for your feedback.  
[root@zch127bld11 genieacs]# systemctl status genieacs-ui  
genieacs-ui.service - GenieACS UI  
Loaded: loaded (/etc/systemd/system/genieacs-ui.service; enabled; vendor preset: disabled)  
Active: active (running) since Mon 2021-06-07 13:38:17 CST; 2s ago  
Main PID: 25168 (node)  
Tasks: 53  
CGroup: /system.slice/genieacs-ui.service  
25168 /extra/vwang2/node/node/bin/node /extra/vwang2/genieacs\_master/genieacs-master/dist/bin/genieacs-ui  
25179 /data/sdc1/vwang2/node/node/bin/node /extra/vwang2/genieacs\_master/genieacs-master/dist/bin/genieacs-ui  
25183 /data/sdc1/vwang2/node/node/bin/node /extra/vwang2/genieacs\_master/genieacs-master/dist/bin/genieacs-ui  
25193 /data/sdc1/vwang2/node/node/bin/node /extra/vwang2/genieacs\_master/genieacs-master/dist/bin/genieacs-ui  
25221 /data/sdc1/vwang2/node/node/bin/node /extra/vwang2/genieacs\_master/genieacs-master/dist/bin/genieacs-ui  
25234 /data/sdc1/vwang2/node/node/bin/node /extra/vwang2/genieacs\_master/genieacs-master/dist/bin/genieacs-ui  
25248 /data/sdc1/vwang2/node/node/bin/node /extra/vwang2/genieacs\_master/genieacs-master/dist/bin/genieacs-ui

Jun 07 13:38:18 zch127bld11 node[25168]: 2021-06-07T05:38:18.905Z [ERROR] Uncaught exception; pid=25241 exceptionName=“MongoNetworkError” exceptionMessage="connection 2 to 127.0.0.1:27017 closed…-master/node\_m  
Jun 07 13:38:18 zch127bld11 node[25168]: 2021-06-07T05:38:18.917Z [ERROR] Worker died; pid=25241 exitCode=0  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.196Z [ERROR] Uncaught exception; pid=25273 exceptionName=“MongoNetworkError” exceptionMessage="connection 2 to 127.0.0.1:27017 closed…-master/node\_m  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.206Z [ERROR] Worker died; pid=25273 exitCode=0  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.367Z [ERROR] Uncaught exception; pid=25187 exceptionName=“MongoNetworkError” exceptionMessage="connection 2 to 127.0.0.1:27017 closed…-master/node\_m  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.381Z [ERROR] Worker died; pid=25187 exitCode=0  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.386Z [ERROR] Uncaught exception; pid=25212 exceptionName=“MongoNetworkError” exceptionMessage="connection 2 to 127.0.0.1:27017 closed…-master/node\_m  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.400Z [ERROR] Worker died; pid=25212 exitCode=0  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.428Z [ERROR] Uncaught exception; pid=25227 exceptionName=“MongoNetworkError” exceptionMessage="connection 2 to 127.0.0.1:27017 closed…-master/node\_m  
Jun 07 13:38:19 zch127bld11 node[25168]: 2021-06-07T05:38:19.442Z [ERROR] Worker died; pid=25227 exitCode=0  
Hint: Some lines were ellipsized, use -l to show in full.

genieacs.env  
GENIEACS\_CWMP\_ACCESS\_LOG\_FILE=/var/log/genieacs/genieacs-cwmp-access.log  
GENIEACS\_NBI\_ACCESS\_LOG\_FILE=/var/log/genieacs/genieacs-nbi-access.log  
GENIEACS\_FS\_ACCESS\_LOG\_FILE=/var/log/genieacs/genieacs-fs-access.log  
GENIEACS\_UI\_ACCESS\_LOG\_FILE=/var/log/genieacs/genieacs-ui-access.log  
GENIEACS\_DEBUG\_FILE=/var/log/genieacs/genieacs-debug.yaml  
NODE\_OPTIONS=–enable-source-maps  
GENIEACS\_EXT\_DIR=/opt/genieacs/ext  
GENIEACS\_UI\_JWT\_SECRET=eyJhbGciOiJIUzI1NiJ9  
GENIEACS\_UI\_INTERFACE=10.213.0.11  
GENIEACS\_UI\_PORT=3000  
GENIEACS\_NBI\_INTERFACE=10.213.0.11  
GENIEACS\_CWMP\_INTERFACE=10.213.0.11  
GENIEACS\_FS\_INTERFACE=10.213.0.11

---

<div class="post-metadata">

**Author:** ![lavira](https://avatars.discourse-cdn.com/v4/letter/l/87869e/32.png) [@lavira](https://forum.genieacs.com/u/lavira)\
**Post date:** [June 7, 2021, 6:20am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/7 "2021-06-07T06:20:51Z")

</div>

Hi, The logs indicate clearly that the service can’t connect to the mongo database. It seems you are missing a line, in the genieacs.env file, like:

```auto
GENIEACS_MONGODB_CONNECTION_URL=mongodb://user:password@127.0.0.1/genieacs

```

Since you don’t mention this, the default connction url is mongodb://127.0.0.1/genieacs and I think you don’t have mongodb running (`systemctl start mongodb`) or you don’t allow the connection. If you forgot to install it, here you can find [install instructions](https://docs.mongodb.com/manual/administration/install-on-linux/).

---

<div class="post-metadata">

**Author:** ![VincentWang](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@VincentWang](https://forum.genieacs.com/u/VincentWang)\
**Post date:** [June 7, 2021, 8:24am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/8 "2021-06-07T08:24:43Z")

</div>

Thank you very much Lavira!  
It is very helpful.  
I have installed mongodb, I am configuring it now.

Vincent

---

<div class="post-metadata">

**Author:** ![VincentWang](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@VincentWang](https://forum.genieacs.com/u/VincentWang)\
**Post date:** [June 8, 2021, 8:33am UTC](https://forum.genieacs.com/t/how-to-pass-ui-jwt-secret-argument-to-supply-the-secret-key-used-for-signing-browser-cookies/1754/9 "2021-06-08T08:33:32Z")

</div>

Many thanks Lavira!  
After configuring mongodb, genieacs-ui works well.  
I use genieacs-sim to do some basic test.  
From “Devices”, I can find the simulator. 🙂
