메인 콘텐츠로 건너뛰기
FIM One은 GitHub, Google, Discord, Feishu(Lark)를 통한 소셜 로그인을 지원합니다. 환경에 자격증명이 있는 모든 제공자는 자동으로 로그인 페이지에 로그인 버튼을 표시합니다 — 코드 변경이 필요하지 않습니다. 콜백 URL 패턴 — 각 제공자의 개발자 콘솔에 이 정확한 URL을 등록합니다:
API_BASE_URL은 FIM One 백엔드의 외부에서 접근 가능한 주소입니다. 예시:

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

개발자 콘솔: https://console.cloud.google.com/apis/credentials
  1. + CREATE CREDENTIALS → OAuth client ID를 클릭합니다.
  2. 메시지가 표시되면 먼저 OAuth consent screen을 구성합니다(개인/공개 앱의 경우 User Type을 “External”로 설정).
  3. Application type을 Web application으로 설정합니다.
  4. Authorized redirect URIs 아래에 다음을 추가합니다:
  5. Create를 클릭한 후 Client ID와 Client Secret을 복사합니다.
자동으로 요청되는 스코프: openid, email, profile
참고: 개발 중에는 동의 화면에 “This app is not verified” 경고가 표시됩니다. 테스트를 위해 이를 무시하고 진행할 수 있습니다. 최종 사용자를 위해 경고를 제거하려면 동의 화면을 게시하세요.

Discord

개발자 콘솔: https://discord.com/developers/applications
  1. New Application을 클릭하고 이름을 입력합니다.
  2. 왼쪽 사이드바에서 OAuth2를 클릭합니다.
  3. Redirects 아래에서 Add Redirect를 클릭하고 다음을 입력합니다:
  4. Client ID(OAuth2 페이지 상단에 표시됨)를 복사하고 Reset Secret을 클릭하여 Client Secret을 확인합니다.
자동으로 요청되는 스코프: identify, email
Discord는 모든 계정에 대해 확인된 이메일을 보장하지 않습니다. 사용자가 Discord에서 이메일을 확인하지 않은 경우 email 필드는 null일 수 있습니다. FIM One은 이 경우 null 이메일로 계정을 생성합니다. 사용자는 나중에 설정에서 이메일을 추가할 수 있습니다.

Feishu (Lark)

테넌트 범위만 해당. Feishu 자체 구축 앱(自建应用)은 앱을 생성한 동일한 엔터프라이즈 테넌트 내의 사용자만 인증할 수 있습니다. 다른 Feishu 테넌트의 사용자는 “권한 없음” 오류를 보게 됩니다. 이는 Feishu OAuth가 서로 다른 조직의 사용자가 있는 공개 SaaS 배포에는 적합하지 않음을 의미합니다. 모든 사용자가 동일한 Feishu 테넌트에 속하는 개인 / 단일 조직 배포에서 잘 작동합니다.테넌트 간 Feishu 로그인을 지원하려면 Feishu 앱 디렉토리(应用商店)에 앱을 게시하고 Feishu의 검토 프로세스를 통과해야 합니다. 이는 복잡하고 엄격한 요구사항이 있습니다.
개발자 콘솔: https://open.feishu.cn/app
  1. Create App → In-house app(自建应用)을 클릭합니다. 회사/엔터프라이즈 계정이 필요합니다. Feishu OAuth는 개인 계정에서 사용할 수 없습니다.
  2. Permissions & Scopes 아래에서 다음을 검색하여 활성화합니다:
    • contact:user.email:readonly
  3. Security Settings → Redirect URL 아래에 콜백 URL을 추가합니다:
  4. Credentials & Basic Info 섹션에서 App ID와 App Secret을 복사합니다.
콘솔에서 구성된 스코프(인증 URL에서가 아님): contact:user.email:readonly
참고: Feishu는 표준 Client ID / Client Secret 명명 대신 App ID / App Secret을 사용합니다. 환경 변수 이름이 이를 반영합니다: FEISHU_APP_ID와 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.

계정 연결 규칙

등록된 사용자는 설정 → 계정에서 추가 OAuth 제공자를 연결할 수 있습니다. 사용자가 연결을 시작할 때 다음 규칙이 적용됩니다:

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.