I think the private data (such as tokens) can be stored in system-wide secret store. Although they can be easily read by other programs on same machine, it still provide some kind of security because they are only unlocked when computer is logged in.
I know this isn't safer than current plain text store. However system provide these API for free, why not provide a option to use them?
The only downside is more dependencies. Windows side need JNA to access credential store, and Linux side need this library.
I can PR the changes if you accept the idea.