The recommended practice is to change the AppKey in The Things Network V2.
I’m poking around in the v2 ttn console and I feel like a bit of a dunce as I can’t find where or how to change the app key for my devices. Also, do I have to do this for each device individually or is there a script I can run to do this en masse for all the devices in my application?
Applications > my application id > Devices > some device id > Settings
Still would rather not have to click through hundreds of devices to do this if there’s a less Byzantine approach… anyone know? I guess I could see what the console does in dev-tools and write a NodeJS script…
I didn’t realize the ttn-lw-migrate tool could do that… the help certainly doesn’t suggest that it can:
Available Commands:
application Export all devices of an application
device Export devices by DevEUI
help Help about any command
sources List available sources
version Print version information
Flags:
--dev-id-prefix string (optional) value to be prefixed to the resulting device IDs
--dry-run Do everything except resetting root and session keys of exported devices
--frequency-plans-url string URL for fetching frequency plans (default "https://raw.githubusercontent.com/TheThingsNetwork/lorawan-frequency-plans/master")
-h, --help help for ttn-lw-migrate
--verbose Verbose output
Use "ttn-lw-migrate [command] --help" for more information about a command.
Anyway, I got it done with a simple-enough node script, copied my cookie and authorization headers out of dev tools in Chrome and ran this (using the devices I exported using the ttn-lw-migrate tool). Basically just a PATCH to https://v2console.thethingsnetwork.org/api/applications{app_id}/devices/{dev_id} with a body that looks like this: