BalenaRequestError: Request error: Unauthorized


Dear balena team,
first of all, thank you for working on openbalena. The approach of managing iot devices using docker is great.

Unfortunately I have some problems to login with the balena-cli:

I’ve installed openbalena on an Oracle Vm VirtualBox OS Ubuntu 18.04.1 LTS.
Created superuser: ./scripts/quickstart -U super@local -P mypassword -d
Installed balena-cli on Windows 10 Pro 64bit and copied the ca.crt file from the openbalena server to the client os.

When trying to login I get this error:
BalenaRequestError: Request error: Unauthorized

I scrupulously checked email address and password. I’m not able to find the reason for the error.


Hello @rossiman, how do you invoke the CLI command? You must point the CLI to the location of your server, i.e. invoke it like so:

$ export
$ export NODE_EXTRA_CA_CERTS=/path/to/ca.crt
$ balena login

The key is BALENARC_BALENA_URL, but I’ve also added NODE_EXTRA_CA_CERTS for completeness.


Hello @dfunckt,

Thank you for the immediate response. I didn’t set BALENARC_BALENA_URL, but I changed the hosts file as described in How to setup CNAME .

Just for doing a double-check I set BALENARC_BALENA_URL to a wrong url. I got this error:
ENOTFOUND: request to failed, reason: getaddrinfo ENOTFOUND

I also tried to set a wrong link for NODE_EXTRA_CA_CERTS. I got this error:
SELF_SIGNED_CERT_IN_CHAIN: request to failed, reason: self signed certificate in certificate chain

Seems that I do have the right value for both settings. I do have access to the api and I use the correct certificate. Is there any restriction/rule for the email address and the password? I use a very simple unsecure combination of super@local password:nix for testing.


@rossiman, could you paste the whole output from the command? This will show the host being used, like so…

$ balena login
 _            _
| |__   __ _ | |  ____  _ __    __ _
| '_ \ / _` || | / __ \| '_ \  / _` |
| |_) | (_) || ||  ___/| | | || (_) |
|_.__/ \__,_||_| \____/|_| |_| \__,_|

Logging in to
? How would you like to login? (Use arrow keys)
❯ Web authorization (recommended)
  Authentication token
  I don't have a balena account!

As you can see in the output above, it is using This is a good way to confirm that the requests are going to your OpenBalena install, and not to Balena Cloud.

C:\Users\Stefan>balena login
 _            _
| |__   __ _ | |  ____  _ __    __ _
| '_ \ / _` || | / __ \| '_ \  / _` |
| |_) | (_) || ||  ___/| | | || (_) |
|_.__/ \__,_||_| \____/|_| |_| \__,_|

Logging in to
? How would you like to login? Credentials
? Email: super@local
? Password: [hidden]
BalenaRequestError: Request error: Unauthorized

If you need help, don't hesitate in contacting us at:



Hi @richbayliss, hi balena team
I’ve started with a comple new server installation from scratch. Now it’s working! I’m able to login.
I don’t know whats different. I didn’t changed the balena-cli installation on my windows computer.
Thank you for your support


Having the exact same issue on a brand new machine. I setup followed all the instructions in the Getting Started doc, and when I try and login from CLI I am getting BalenaRequestError: Request error: Unauthorized.

I setup user using the quickstart script. Also tried again using the create-superuser script to add a user and still getting same message.

EDIT: looks like the password was truncated due to a special character. re-ran quickstart after deleting the config folder and all is good.


I think I also found how I can solve my problem. After doing new configuration by deleting the config folder and start with quickstart again it did’nt work. I got the same error message when doing the balena login.
After linux reboot it works again.


Seems that I was wrong by telling I can solve my problem. I can not reproduce to fix the problem by reboot. I’ve tried it with a new setup, because I wanted to change to another domain. Again the same error:
BalenaRequestError: Request error: Unauthorized
I don’t know what I’ve done differently to the working setup. Would be great to know which part of the code is throwing the error.


I have the same problem.I have deleted the old openbalena server upgrade to latest version.
Now when using balena login :

SELF_SIGNED_CERT_IN_CHAIN: request to failed, reason: self signed certificate in certificate chain

If you need help, don’t hesitate in contacting us at:


It would be really helpful if the error message can indicate if the problem is in the client or server side.


To all having the same problems with cli login.
Meanwhile I found a way to get the server running and being able to log in using balena-cli.

I’ve started with a new installation on Ubuntu 18.04.1 x64 server.
I’ve used to define the needed domains. -> How to setup CNAME
I’ve processed all the steps as described in
I’ve copied the certificate ./open-balena/config/certs/root/ca.crt to the client.
I’ve installed balena-cli, set the env variable to link to the server and the certificate and logged.

Just by deleting the open-balena/config folder and starting by ./scripts/quickstart didn’t work in my case. I always got the Unauthorized error.


I’m getting Unauthorized as well. I have tried all of the suggestions here and reinstalled a few times. Are there any logs, etc. that I should be looking at? Any other debugging suggestions?


I have the exact same problem. Followed the instructions from the getting started page and getting “Unauthorized”
Earlier that day i got it running and then wanted to make a clean solution with the result, that even from a fresh build it always gives me the “Unauthorized” message.

Update: I managed to get this working and i guess that is the same problem that 99% have
When reinstalling the thing i.e. deleting containers, running ./scripts/quickstart again to add another user the files are still persited in the according docker volumes.
To do a real cleanup one must delete those volumes as well
What i did was: Cleaning Containers and running $ docker volume prune
That will get rid of all unused volumes and thus all previous set settings


indeed - you should also be able to use the ./scripts/compose down -v (from memory here) to bring down the stack and prune the volumes in one fell swoop.