onedrive-api icon indicating copy to clipboard operation
onedrive-api copied to clipboard

Add serialization support for TokenResponse struct

Open AlexanderProd opened this issue 10 months ago • 1 comments

It would be nice to have serialization support for the TokenResponse struct, to save it to a file for persistence between app restarts without having to manually log in again.

AlexanderProd avatar Apr 20 '24 17:04 AlexanderProd

It would be nice to have serialization support for the TokenResponse struct, to save it to a file for persistence between app restarts without having to manually log in again.

I'm not convinced by the reason. Serializing the whole TokenResponse, which is explicitly marked as #[non_exhaustive] and contains unrelated data like scope, does not really make sense. Also according to the OAuth design, token is expected to be short-lived (1hour expiration time by default). My suggestion is to store only refresh_token and keep the token only in memory.

oxalica avatar May 27 '24 19:05 oxalica