ChimeHQ/OAuthenticator

Multiple accounts

Closed this issue · 6 comments

Right now, the Authenticator class only supports one account. This is because LoginStorage has no concept of context. This came up in #9 by @martindufort.

It is absolutely possible to just create one instance per account. But, I'd like to understand if having a single Authenticator that supports multiple accounts is useful/desirable.

Hmm, thinking about this more, it is actually way more involved. The authentication state is also per-account. Sharing multiple accounts would mean tracking all that independent. And that's exactly what multiple Authenicator instances currently do...

I think you are right.
I can define a LoginStorage specific per acccount with the proper context identifier.
Let me try something like:

var authenticatedAccounts: [String: Authenticator]

I'm pretty confident this will work. Are you ok with doing it this way?

Let me try that !!!
This will remove the requirements to have the retrieveLogin() function public

This issue can be closed. Multiple Authenticators is doing the job.

Ok great!