# Automating preauthorization using the API

**URL:** <https://hub.mender.io/t/automating-preauthorization-using-the-api/3152>\
**Category:** General Discussions\
**Tags:** raspberry-pi-4, preauthorization\
**Created:** [January 28, 2021, 10:38pm UTC](https://hub.mender.io/t/automating-preauthorization-using-the-api/3152 "2021-01-28T22:38:00Z")\
**Posts on this page:** 1\
**Showing post:** 23

<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:** [February 5, 2021, 8:19pm UTC](https://hub.mender.io/t/automating-preauthorization-using-the-api/3152/23 "2021-02-05T20:19:14Z")

</div>

Interesting. It looks like the sed syntax in this command is specific to GNU sed and does not work with the MacOS version of sed. I was able to get a similar error on my Big Sur machine.

If you have homebrew installed and the sed from there installed as “gsed” you can modify the command to use that instead.

Alternately it looks like using:

```auto
DEVICE_PUBLIC_KEY="$(cat keys-client-generated/public.key | awk 1 ORS='\\n')"

```

will work. Can you give that a shot?

Drew

---

_[View the full topic](https://hub.mender.io/t/automating-preauthorization-using-the-api/3152)._
