가입 수단 5종(이메일·Google·Apple·Kakao·LINE) · 로그인 에뮬레이터 연결 · 최소 지원 Android 10

This commit is contained in:
Sn-Kinos
2026-09-01 01:03:56 +09:00
parent 1d462ebe31
commit 304ad105d6
14 changed files with 770 additions and 54 deletions
+42 -11
View File
@@ -32,23 +32,54 @@ class AuthRepository extends ChangeNotifier {
AuthAccount? get account => _account;
bool get isSignedIn => _account != null;
/// 정책 설계서 §P-01 확정 5종. **순서가 화면 버튼 순서다.**
///
/// 네이버가 빠지고 이메일·LINE 이 들어왔다(답변서 Q7). 카카오·LINE 은 개발자
/// 콘솔 앱 등록에 발주사 사업자 정보가 필요해 아직 키가 없다.
static List<SocialAuthProvider> _defaultProviders() => [
const KeylessSocialProvider(SocialProvider.kakao, [
'카카오 네이티브 앱 키',
'카카오 개발자 콘솔 앱 등록(사업자 정보 필요)',
]),
const KeylessSocialProvider(SocialProvider.naver, [
'네이버 client ID / client secret',
'네이버 개발자센터 앱 등록(사업자 정보 필요)',
]),
const EmailPasswordProvider(),
const GoogleSignInProvider(),
AppleSignInProvider(
webAuthenticationOptions: appleWebAuthenticationOptionsFromEnvironment(),
),
const GoogleSignInProvider(),
// 이메일 가입 구현체는 여기 없다. CD-18 미확정(Q2) — 회신이 오면 이 목록에 추가한다.
// 자세한 사유는 auth.dart 상단 「이메일 가입에 대하여」 참고.
const KeylessSocialProvider(AuthProviderKind.kakao, [
'카카오 네이티브 앱 키',
'카카오 개발자 콘솔 앱 등록(사업자 정보 필요)',
]),
lineProvider,
];
/// 이메일 제공자. 화면이 입력 폼을 띄우기 전에 있는지 확인한다.
EmailAuthProvider? get emailProvider {
for (final p in providers) {
if (p is EmailAuthProvider) return p;
}
return null;
}
/// 이메일 로그인·가입. 결과가 성공이면 세션을 갈아 끼운다.
Future<AuthOutcome> signInWithEmail({
required String email,
required String password,
bool signUp = false,
}) async {
final impl = emailProvider;
if (impl == null) {
return const AuthFailed('E-AUTH-03', '이메일 로그인을 쓸 수 없습니다.');
}
late final AuthOutcome outcome;
try {
outcome = signUp
? await impl.signUpWithEmail(email, password)
: await impl.signInWithEmail(email, password);
} on Object catch (error) {
debugPrint('[AuthRepository] email sign-in failed: ${error.runtimeType}');
return const AuthFailed('E-AUTH-01', '이메일 또는 비밀번호를 확인해 주세요.');
}
if (outcome is AuthSucceeded) _replaceAccount(outcome.account);
return outcome;
}
Future<AuthOutcome> signIn(SocialProvider provider) async {
final impl = providers.firstWhere((p) => p.provider == provider);
late final AuthOutcome outcome;