Connections
A connection links an account — or a single person — to an outside service, so an app can act there on their behalf.
Two ways to connect
- OAuth — the person is sent to the provider, approves access, and comes back. The service keeps the tokens and refreshes them.
- Pasted token — for services that issue an API key or personal token instead.
Per account or per person
A connection belongs either to the account (shared by everyone in it) or to one person (their own, which no one else can use). The app decides which, from who is signed in — never from what the request claims.
Kept safe
Tokens are encrypted at rest and refreshed under a lock, so two requests can't refresh the same token at once and invalidate each other. A refresh the provider refuses is recorded on the connection, so it can be reconnected. Disconnecting removes the stored tokens.