Zum Hauptinhalt springen
FIM One unterstützt Social Login über GitHub, Google, Discord und Feishu (Lark). Jeder Anbieter, dessen Anmeldedaten in der Umgebung vorhanden sind, zeigt automatisch eine Login-Schaltfläche auf der Anmeldeseite an – keine Codeänderungen erforderlich. Callback-URL-Muster – registrieren Sie diese genaue URL in der Entwicklerkonsole jedes Anbieters:
API_BASE_URL ist die extern erreichbare Adresse des FIM One-Backends. Beispiele:

GitHub

Developer console: https://github.com/settings/developers
  1. Click OAuth Apps → New OAuth App.
  2. Fill in:
    • Application name — any name (e.g. FIM One)
    • Homepage URL — your frontend URL (e.g. https://yourdomain.com)
    • Authorization callback URL — https://yourdomain.com/api/auth/oauth/github/callback
  3. Click Register application, then click Generate a new client secret.
  4. Copy the Client ID and the generated Client Secret into your .env.
Scopes requested automatically: read:user, user:email GitHub accounts with a private primary email are handled correctly — FIM One fetches the primary email from /user/emails (not the public profile email) and records whether GitHub marks it verified.

Google

Entwicklerkonsole: https://console.cloud.google.com/apis/credentials
  1. Klicken Sie auf + CREATE CREDENTIALS → OAuth client ID.
  2. Falls aufgefordert, konfigurieren Sie zunächst den OAuth consent screen (setzen Sie User Type auf “External” für persönliche/öffentliche Apps).
  3. Setzen Sie Application type auf Web application.
  4. Fügen Sie unter Authorized redirect URIs hinzu:
  5. Klicken Sie auf Create, dann kopieren Sie die Client ID und das Client Secret.
Automatisch angeforderte Bereiche: openid, email, profile
Hinweis: Während der Entwicklung zeigt der Zustimmungsbildschirm eine Warnung “This app is not verified” an. Sie können diese zum Testen überspringen. Veröffentlichen Sie den Zustimmungsbildschirm, wenn Sie die Warnung für Endbenutzer entfernen möchten.

Discord

Entwicklerkonsole: https://discord.com/developers/applications
  1. Klicken Sie auf New Application und geben Sie einen Namen ein.
  2. Klicken Sie in der linken Seitenleiste auf OAuth2.
  3. Klicken Sie unter Redirects auf Add Redirect und geben Sie Folgendes ein:
  4. Kopieren Sie die Client ID (oben auf der OAuth2-Seite angezeigt) und klicken Sie auf Reset Secret, um das Client Secret anzuzeigen.
Automatisch angeforderte Bereiche: identify, email
Discord garantiert keine verifizierte E-Mail für alle Konten. Wenn ein Benutzer seine E-Mail bei Discord nicht verifiziert hat, kann das Feld email null sein. FIM One erstellt das Konto in diesem Fall mit einer Null-E-Mail — der Benutzer kann später eine in den Einstellungen hinzufügen.

Feishu (Lark)

Nur Mandanten-Bereich. Feishu-Eigenanwendungen (自建应用) können nur Benutzer innerhalb des gleichen Unternehmens-Mandanten authentifizieren, der die App erstellt hat. Benutzer von anderen Feishu-Mandanten sehen eine Fehlermeldung “keine Berechtigung”. Das bedeutet, dass Feishu OAuth nicht für öffentliche SaaS-Bereitstellungen geeignet ist, bei denen Benutzer aus verschiedenen Organisationen stammen. Es funktioniert gut für private / Einzelorganisations-Bereitstellungen, bei denen alle Benutzer zum gleichen Feishu-Mandanten gehören.Um mandantenübergreifende Feishu-Anmeldung zu unterstützen, müssen Sie die App im Feishu App Directory (应用商店) veröffentlichen und Feishus Überprüfungsprozess durchlaufen — was komplex ist und strenge Anforderungen hat.
Entwicklerkonsole: https://open.feishu.cn/app
  1. Klicken Sie auf Create App → In-house app (自建应用). Unternehmens- oder Geschäftskonten sind erforderlich — Feishu OAuth ist nicht für persönliche Konten verfügbar.
  2. Unter Permissions & Scopes suchen Sie nach und aktivieren Sie:
    • contact:user.email:readonly
  3. Unter Security Settings → Redirect URL fügen Sie Ihre Callback-URL hinzu:
  4. Kopieren Sie die App ID und App Secret aus dem Abschnitt Credentials & Basic Info.
Bereiche, die in der Konsole konfiguriert sind (nicht in der Autorisierungs-URL): contact:user.email:readonly
Hinweis: Feishu verwendet App ID / App Secret statt der Standard-Benennungen Client ID / Client Secret. Die Umgebungsvariablennamen spiegeln dies wider: FEISHU_APP_ID und FEISHU_APP_SECRET.

Important: Feishu Email Behavior

The Feishu user info API (authen/v1/user_info) returns an email and an enterprise contact email (联系邮箱, enterprise_email) — the address configured by the organization admin in the Feishu admin console. FIM One reads email first, then enterprise_email. The address counts as verified only when it is the enterprise email of a tenant listed in FEISHU_TRUSTED_TENANT_KEYS. Consequences:
  • Users whose org admin has not configured a contact email will get an empty email field from the API, even though they have a valid Feishu account.
  • Users on personal Feishu accounts (not part of an enterprise) will always get an empty email.
FIM One handles this gracefully: see Account Binding Rules below.

Kontobindungsregeln

Registrierte Benutzer können zusätzliche OAuth-Anbieter über Einstellungen → Konto verknüpfen. Die folgenden Regeln gelten, wenn ein Benutzer eine Bindung initiiert:

Linking from Settings (all providers)

Linking needs a full sign-in: a session that has passed two-factor authentication where it is enabled. API keys and the temporary 2FA token cannot link a provider.
  • Both sides have an email → the email returned by the provider must match the FIM account’s email. This prevents accidentally linking another person’s social account to your FIM account. A mismatch is rejected with an email_mismatch error.
  • Either side has no email (the provider returned none, or the FIM account has no email) → binding succeeds on the signed-in session alone. In practice this affects Feishu accounts without an enterprise email and some Discord accounts.

First sign-in with a provider (no binding yet)

When a user signs in through a provider that is not linked to any account yet:
  1. FIM One looks for an existing account with the same email. The match is used only when the address is verified on both sides: the provider reports it as verified, and the existing account’s email is verified. For Feishu, “verified” means the enterprise email of a tenant listed in FEISHU_TRUSTED_TENANT_KEYS.
  2. If a match is found, the provider is linked to that existing FIM account and the user is logged in.
  3. Otherwise a new FIM account is created with whatever email the provider returned (none, if it returned none). This is refused with registration_disabled when registration is disabled or invite-only.
When is an account’s email verified? When it was registered with the emailed verification code (email_verification_enabled on and SMTP configured), when an administrator created it, when it is the first account of the installation, or when it was created by a provider sign-in whose provider reported the address as verified. An account registered with an email and a password on a deployment that does not send verification codes holds an unverified address: a provider sign-in for that address is not linked to it and creates a separate account instead, so two accounts can then hold the same address. A password signs in to the account it was set on; an emailed sign-in or reset code goes to the account whose address is verified. To use one account with both, sign in with the password first and link the provider under Settings → Account, instead of using the provider’s button on the sign-in page. If the matched or linked account has two-factor authentication enabled, the sign-in stops at the 2FA step before a session is issued.

Environment Variables Quick Reference

“Required: Both” means both the _ID and _SECRET (or _APP_ID and _APP_SECRET for Feishu) must be set together; setting only one has no effect.
See Environment Variables for full documentation of FRONTEND_URL, API_BASE_URL, and NEXT_PUBLIC_API_URL.