Is it possible to permanently authorise extensions (Python API) gregd

I use a Python script to retrieve playing info from Roon via API from a Raspberry Pi. If the Pi restarts I need to manually go into the Roon App and re-authorise gregd (Python library for Roon).

Is there any way to ensure this is always authorised?

Here’s the code I use:

token = open("/home/pi/mytokenfile").read()
server = "192.168.0.100"
roonapi = RoonApi(appinfo, token, server, 9330)

Edit: I’ve discovered if I restart my script then auth is needed again in the Roon App, maybe its something I’m doing incorrectly?

That likely means the token in your token file is invalid.

You need to store the token after you re-authorise.

You can see an example at the end of the code here:-

thanks!

Its working now. I don’t think I was saving/loading the token correctly. Also, I was calling it from a systemctl script so I set the location of the token to be a specific path rather than a relative one.

1 Like