# Can't authorize devices: auth\_set empty if identity too long

**URL:** <https://hub.mender.io/t/cant-authorize-devices-auth-set-empty-if-identity-too-long/2173>\
**Category:** General Discussions\
**Created:** [July 10, 2020, 7:51am UTC](https://hub.mender.io/t/cant-authorize-devices-auth-set-empty-if-identity-too-long/2173 "2020-07-10T07:51:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![edgar444](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/edgar444/32/684_2.png) [@edgar444](https://hub.mender.io/u/edgar444)\
**Post date:** [July 10, 2020, 7:51am UTC](https://hub.mender.io/t/cant-authorize-devices-auth-set-empty-if-identity-too-long/2173/1 "2020-07-10T07:51:31Z")

</div>

Some devices, if they have too long identity fields, become impossible to authorize, and even after purging (only purging is still possible at least via cURL, where as WebUI hides buttons for both actions).

That is due the server never full-filling the auth\_sets field, which is mandatory to authorize the device, this renders the device inaccessible to updates. As shown below, the `list_devices` output exemplifies where auth\_sets is empty.

```auto
json[13].auth_sets = [];
json[13].created_ts = "2020-07-10T06:52:47.927Z";
json[13].decommissioning = false;
json[13].id = "0485e482-4257-435a-8613-4798a5a2236a";
json[13].identity_data = {};
json[13].identity_data.flash_otherdate = "2020-01-20T15:16:58Z";
json[13].identity_data.flash_date = "2020-07-10T06:52:46Z";
json[13].identity_data.flash_owner = "The original caretaker and device owner";
json[13].identity_data.flash_uuid = "0485e482-4257-435a-8613-4798a5a2236a";
json[13].identity_data.hw_hardware = "BCM2835";
json[13].identity_data.hw_model = "Raspberry Pi 3 Model B Plus Rev 1.3";
json[13].identity_data.hw_revision = "000000";
json[13].identity_data.hw_serial = "0000000000000000";
json[13].identity_data.mac = "a4:42:f3:2f:34:88";
json[13].status = "pending";
json[13].updated_ts = "2020-07-10T06:52:47.927Z";

```

commands used:

```auto
# Sanity pre-checks
which curl base64 jq gron >/dev/null

curl_opts=(--silent --verbose) # --insecure

login() {
	MENDER_SERVER_URI=${MENDER_SERVER_URI-'https://127.0.0.1:443'}
	JWT=$(read -rp 'user: ' user; read -srp 'pass: ' pass; curl "${curl_opts[@]}" -X POST "$MENDER_SERVER_URI"/api/management/v1/useradm/auth/login -H "Authorization: Basic $(printf %s:%s "$user" "$pass" | base64 -w0)")
	declare -p MENDER_SERVER_URI JWT
}

list_devices() {
	curl "${curl_opts[@]}" -X GET $MENDER_SERVER_URI/api/management/v2/devauth/devices -H "Authorization: Bearer $JWT"
}

nuke_devices() {
	for x in $(curl "${curl_opts[@]}" -H "Authorization: Bearer $JWT" $MENDER_SERVER_URI/api/management/v2/devauth/devices | jq -r .[].id); do
		time (set -x; curl "${curl_opts[@]}" -H "Authorization: Bearer $JWT" -X DELETE $MENDER_SERVER_URI/api/management/v2/devauth/devices/$x | jq .)
	done
}

login
list_devices
nuke_devices
sleep 1h
list_devices

```

I’m posting here as issue pages are disabled on mendersoftware/integration.

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [July 10, 2020, 2:26pm UTC](https://hub.mender.io/t/cant-authorize-devices-auth-set-empty-if-identity-too-long/2173/2 "2020-07-10T14:26:46Z")

</div>

Hi @edgar444 thanks for the detailed writeup. @tranchitella, @merlin can you guys review and create an appropriate JIRA ticket?

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)\
**Post date:** [July 10, 2020, 8:07pm UTC](https://hub.mender.io/t/cant-authorize-devices-auth-set-empty-if-identity-too-long/2173/3 "2020-07-10T20:07:55Z")

</div>

Hello and thank you for trying Mender and the report. I confirm it is a bug and will be fixed in the next release. it is due to a total length of identity data.

peter

---

<div class="post-metadata">

**Author:** ![eystein](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@eystein](https://hub.mender.io/u/eystein)\
**Post date:** [July 13, 2020, 5:51pm UTC](https://hub.mender.io/t/cant-authorize-devices-auth-set-empty-if-identity-too-long/2173/4 "2020-07-13T17:51:39Z")

</div>

Hi @edgar444 ,

Thanks for the report, it is being tracked here: [https://tracker.mender.io/browse/MEN-3816](https://tracker.mender.io/browse/MEN-3816)

I would also mention that some of what you have as identity data might be better suited for inventory. You can see the difference here [https://docs.mender.io/hosted/overview/identity](https://docs.mender.io/hosted/overview/identity) and here [https://docs.mender.io/hosted/overview/inventory](https://docs.mender.io/hosted/overview/inventory)

PS! The official issue tracker for Mender is here: [https://tracker.mender.io/projects/MEN](https://tracker.mender.io/projects/MEN)
