Mender Authentication Error

Hi,

I ran into following error when I try to onboard a new device.

Authorize failed: transient error: authorization request failed: (request_id: ): authentication request rejected server error message: dev auth: unauthorized

Jan 12 13:20:42 imx8mq-itx-p-c444 mender[491]: time="2021-01-12T13:20:42Z" level=error msg="Authorize failed: transient error: authorization request failed: (request_id: ): authentication request rejected server error message: dev auth: unauthorized"
Jan 12 13:20:42 imx8mq-itx-p-c444 mender[491]: time="2021-01-12T13:20:42Z" level=error msg="Authorize failed: transient error: authorization request failed: (request_id: ): authentication request rejected server error message: dev auth: unauthorized"
Jan 12 13:20:42 imx8mq-itx-p-c444 mender[491]: time="2021-01-12T13:20:42Z" level=info msg="State transition: authorize [Sync] -> authorize-wait [Idle]"
Jan 12 13:20:47 imx8mq-itx-p-c444 mender[491]: time="2021-01-12T13:20:47Z" level=info msg="State transition: authorize-wait [Idle] -> authorize [Sync]"
Jan 12 13:20:47 imx8mq-itx-p-c444 mender[491]: time="2021-01-12T13:20:47Z" level=error msg="Authorize failed: transient error: authorization request failed: (request_id: ): authentication request rejected server error message: dev auth: unauthorized"
Jan 12 13:20:47 imx8mq-itx-p-c444 mender[491]: time="2021-01-12T13:20:47Z" level=error msg="Authorize failed: transient error: authorization request failed: (request_id: ): authentication request rejected server error message: dev auth: unauthorized"
Jan 12 13:20:47 imx8mq-itx-p-c444 mender[491]: time="2021-01-12T13:20:47Z" level=info msg="State transition: authorize [Sync] -> authorize-wait [Idle]"

Also I referred the Hub and output of /usr/share/mender/identity/mender-device-identity is,

using interface /sys/class/net/eth0
mac=00:01:45:09:ca:7c

and my mender.conf is:

{
    "InventoryPollIntervalSeconds": 5,
    "RetryPollIntervalSeconds": 5,
    "ServerURL": "https://hosted.mender.io",
    "TenantToken": "MENDER_TENET_TOKEN",
    "UpdatePollIntervalSeconds": 5
}

Any help would be much appreciated.

UPDATE 1:

When I try using other account (hosted.mender.io) it is working fine. Is it something related to Mender accounts?

last time i checked the output of mender-device-identity should only be key-value pairs,
Have you pre-authorized/accepted the new device you are trying to connect in the server UI ?

No, nothing of that sort.

I’m still getting the same output for the mender-device-identty but it is working fine in other account.

so the output of your mender-device-identity is:

mac=00:01:45:09:ca:7c

and not

using interface /sys/class/net/eth0
mac=00:01:45:09:ca:7c
root@imx8mq-itx-p-c444:~# /usr/share/mender/identity/mender-device-identity 
using interface /sys/class/net/eth0
mac=00:01:45:09:ca:7c
root@imx8mq-itx-p-c444:~# 

But when I execute that command I receive the above output. What does that mean?

the output of mender-device-identity should only contain key value/pairs or comments, so i don’t know how the mender client parser will handle what you have as output. You need to remove the following line from your mender-device-identity script

using interface /sys/class/net/eth0

if you didnt write the mender-device-identity script you are using then its probably an upstream bug

ignore that, i’m wrong, i have just checked the upstream script and the line i suggested you remove is going to stderr not stdout so thats why you are seeing both on the terminal. The mender client will almost certainly only parse from stdout

1 Like

just to recap, you should always get an unauthorized 401 from the server for a new device the first time you connect it unless you have already pre-authorized it some how. Double check the new device is not in the pending devices section of the server.

apart from that i don’t use hosted.mender.io so I’m, not sure what you mean by “accounts” but I would expect your TenantToken to be different to what you have in your config file, but as i said I’m not familar with this setup sorry.

1 Like