tarickb / sasl-xoauth2

SASL plugin for XOAUTH2
Other
72 stars 20 forks source link

Preserving additional fields in token file #77

Closed kpedro88 closed 8 months ago

kpedro88 commented 8 months ago

I noticed when obtaining a new token that the extra fields I had previously specified in the token file weren't preserved (i.e. user that I added in #74). I can think of two ways to fix this:

  1. add a --user flag to sasl-xoauth2-tool
  2. check if the file provided in the output_file argument in sasl-xoauth2-tool already exists, load it into a dict, and then update() the dict with the new token dict before writing back to the output file. (This is more general, but maybe overkill.)

Let me know which one is preferred and I'll send a PR.

tarickb commented 8 months ago

I'm conflicted on this one. If we add --user to sasl-xoauth2-tool then we should probably also add flags for all the other fields that can be present in a token file. That, like your second suggestion, feels like overkill. That having been said I think I'd be more comfortable with an --overwrite_existing_token flag that implements the second option.