seldo/alpaca

Multiple account login

Closed this issue · 1 comments

seldo commented

Currently Alpaca only knows how to log in to seldo.dev. To allow multiple login instance we need:

  • A login screen where you select an instance somehow
  • An "instances" table that stores the per-instance data, since we're only registering one app per instance
  • An auth flow that can get an app ID for an instance we've never met without me manually registering there
  • Somewhere to store both of the above, probably on the user table, which means...
  • An "instance" column on the user table
  • And also on the tweets, notifications, and every other table
  • And indexes that take all of those into account
  • Changing all mastodon.server requests to use the user's current instance data instead of the env var(s)
  • Some indicator of what instance you're currently logged in on

Stretch goal (it's okay if you can log in to multiple instances, but only one at a time)

  • A widget that shows all the instances you're currently logged in
  • A way to switch between them
seldo commented

Current flow is:

/auth/login goes to
/auth/mastodon which instantiates
authenticator from auth.server
which is an instance of MastodonStrategy populated with env vars and a custom callback which redirects to
/auth/callback which checks that you're correctly authed and if so sends you to
/home

What needs to change

mastodonstrategy is properly generic
so authenticate needs to be replaced with getOrCreateInstance
if an instance does not exist
    register an application with that instance
    store the details
instantiate a mastodonstrategy with the instance supplied from db

and I think after that everything works?