# Mender Preauthorisation - bringing the state of the device from preauthorized to accepted

**URL:** <https://hub.mender.io/t/mender-preauthorisation-bringing-the-state-of-the-device-from-preauthorized-to-accepted/6407>\
**Category:** General Discussions\
**Tags:** identity, preauthorization, mender-device-identity\
**Created:** [December 7, 2023, 1:04pm UTC](https://hub.mender.io/t/mender-preauthorisation-bringing-the-state-of-the-device-from-preauthorized-to-accepted/6407 "2023-12-07T13:04:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Utsav\_Shah](https://avatars.discourse-cdn.com/v4/letter/u/3ab097/32.png) [@Utsav\_Shah](https://hub.mender.io/u/Utsav_Shah)\
**Post date:** [December 7, 2023, 1:04pm UTC](https://hub.mender.io/t/mender-preauthorisation-bringing-the-state-of-the-device-from-preauthorized-to-accepted/6407/1 "2023-12-07T13:04:59Z")

</div>

I am trying to preauthorize a device onto the mender dashboard.  
I am referring to the below article:

[https://docs.mender.io/server-integration/preauthorizing-devices](https://docs.mender.io/server-integration/preauthorizing-devices)

For this I have done the following:

1. Used the mender keygen-client to generate a set of public and private key for the device
2. Used the public key to hit the mender API that puts the particular device into pre-authorisation state.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/d/d3d772c367ae88be4f9f31aec7f012f9a66ef3c1.png)  
The device does come up in the mender dashboard as preauthorized.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/c/c9d42a3ed0ffa6176ce0e9a6419853c610534dbd.png)

What I am trying now is to make the device go from pre-auth state to accepted state for which I have copied the private key (generated from the keygen-client tool) into /data/mender/mender-agent.pem file.  
After a restart of the mender client service, insted of making the device go into accepted state a new device request comes on the dashboard (in pending state). So now I have one device entry in preauthorized state and a new entry in pending state.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/8/865e9e68fffad60a879d1e2b5b81df985fe6766c.png)

I had read in the article mentioned above that by default mender considers the MAC ID of the device as the unique identity parameter.  
There is a file : mender-device-identity in /etc/mender/identity, it is a script and when I run that it gives the MAC ID of the device as output. I tried modifying the script to output either the serial number, MAC ID or device ID but each time the device was never going into accepted state.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/1/1d070a04105c834de9f2183e3079bb2adfe4f548.png)

Can someone help me in identifying where I am going wrong with this? I am looking out for a logical flow on how to make the device go to accepted state from pre-authorized state.

---

<div class="post-metadata">

**Author:** ![mister\_kanister](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mister\_kanister](https://hub.mender.io/u/mister_kanister)\
**Post date:** [December 7, 2023, 1:59pm UTC](https://hub.mender.io/t/mender-preauthorisation-bringing-the-state-of-the-device-from-preauthorized-to-accepted/6407/2 "2023-12-07T13:59:29Z")

</div>

If you execute `/etc/mender/identity` the output should be

```auto
sku=<yoursku>
mac=<yourmac>
sn=<yoursn>

```

and nothing more. The output must correspond to the input of your preauth request. Errors could result that the device is not identified properly. I see in your last image some data is commented out.

Check logs of the client and paste them `systemctl status mender` or equivalent.
