Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List cached accounts #74

Open
Gjum opened this issue Sep 8, 2023 · 1 comment
Open

List cached accounts #74

Gjum opened this issue Sep 8, 2023 · 1 comment

Comments

@Gjum
Copy link
Member

Gjum commented Sep 8, 2023

Is your feature request related to a problem? Please describe.

I want to provide the user with a convenient selection menu for all cached accounts that she has previously used.

None of the ABC_*-cache.json files seem to contain any reference to the user identifier passed when calling Authflow, nor the resolved Minecraft username/UUID.

Looking up each cache's username one by one would delay the application startup and has me worried about Microsoft API rate limits.

Describe the solution you'd like

User identifier (and/or Minecraft username/UUID) is cached together with the ABC_*-cache.json files

Describe alternatives you've considered

Tracking the past used accounts in a separate file maintained by the app; this would mean that accounts cached by one app would not be known to another app on the same machine.

@extremeheat
Copy link
Member

Where and how exactly the cached data are stored for accounts is really an implementation detail, not something apart of the stable API. It's not indexed anywhere because the code is designed to retrieve and cache with the expectation that the retrieval may fail for any reason, like the cache not existing or expiring.

If stored in the file system for example the expectation is the data would be stored in a temporary folder (like /tmp or %temp%) that could be periodically reclaimed by the system. Or if running in the browser that data could be stored in local storage.

Just because data may be stored in the cache doesn't mean the tokens stored as valid, and the only way to know is to actively try and authenticate with them. For your use case I'd recommend making a separate accounts.json for your app. However, I think it would be possible with some work to expose a method to just check hasValidXCache(identifier, cache) just looking at token expiry dates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants