This has already been done here: https://github.com/JGillam/burp-oauther
It would be great to merge them and add additional UI features as necessary to it.
Alternatively, a config.xml (or properties file) can be used to keep the current configuration. So the extension reads it during load time.