Let a signed-in user add another sign-in method (for example GitHub next to e-mail) to the same account.
Users who sign in with different methods but the same verified e-mail address are linked to one user automatically. To let a signed-in user link a provider with a different address (or an anonymous user keep their data when they sign in with OAuth), turn on Allow manual identity linking in Studio → Authentication → Settings.
JavaScript
const { data, error } = await stitchdb.auth.linkIdentity({ provider: 'github' }) // redirects to GitHub, returns linked
const { data: { identities } } = await stitchdb.auth.getUserIdentities()
await stitchdb.auth.unlinkIdentity(identities.find((i) => i.provider === 'github')) // a user keeps at least one