API_BASE_URL은 FIM One 백엔드의 외부에서 접근 가능한 주소입니다. 예시:
GitHub
Developer console: https://github.com/settings/developers- Click OAuth Apps → New OAuth App.
- 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
- Application name — any name (e.g.
- Click Register application, then click Generate a new client secret.
- Copy the Client ID and the generated Client Secret into your
.env.
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.
- + CREATE CREDENTIALS → OAuth client ID를 클릭합니다.
- 메시지가 표시되면 먼저 OAuth consent screen을 구성합니다(개인/공개 앱의 경우 User Type을 “External”로 설정).
- Application type을 Web application으로 설정합니다.
- Authorized redirect URIs 아래에 다음을 추가합니다:
- Create를 클릭한 후 Client ID와 Client Secret을 복사합니다.
openid, email, profile
참고: 개발 중에는 동의 화면에 “This app is not verified” 경고가 표시됩니다. 테스트를 위해 이를 무시하고 진행할 수 있습니다. 최종 사용자를 위해 경고를 제거하려면 동의 화면을 게시하세요.
Discord
개발자 콘솔: https://discord.com/developers/applications- New Application을 클릭하고 이름을 입력합니다.
- 왼쪽 사이드바에서 OAuth2를 클릭합니다.
- Redirects 아래에서 Add Redirect를 클릭하고 다음을 입력합니다:
- Client ID(OAuth2 페이지 상단에 표시됨)를 복사하고 Reset Secret을 클릭하여 Client Secret을 확인합니다.
identify, email
Discord는 모든 계정에 대해 확인된 이메일을 보장하지 않습니다. 사용자가 Discord에서 이메일을 확인하지 않은 경우null일 수 있습니다. FIM One은 이 경우 null 이메일로 계정을 생성합니다. 사용자는 나중에 설정에서 이메일을 추가할 수 있습니다.
Feishu (Lark)
개발자 콘솔: https://open.feishu.cn/app- Create App → In-house app(自建应用)을 클릭합니다. 회사/엔터프라이즈 계정이 필요합니다. Feishu OAuth는 개인 계정에서 사용할 수 없습니다.
- Permissions & Scopes 아래에서 다음을 검색하여 활성화합니다:
contact:user.email:readonly
- Security Settings → Redirect URL 아래에 콜백 URL을 추가합니다:
- Credentials & Basic Info 섹션에서 App ID와 App Secret을 복사합니다.
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.
계정 연결 규칙
등록된 사용자는 설정 → 계정에서 추가 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_mismatcherror. - 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:- 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. - If a match is found, the provider is linked to that existing FIM account and the user is logged in.
- Otherwise a new FIM account is created with whatever email the provider returned (none, if it returned none). This is refused with
registration_disabledwhen registration is disabled or invite-only.
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 ofFRONTEND_URL,API_BASE_URL, andNEXT_PUBLIC_API_URL.