Android Apple 로그인을 Firebase 웹 흐름으로

This commit is contained in:
Sn-Kinos
2026-10-08 15:44:49 +09:00
parent 586039da0a
commit 0b95454b28
4 changed files with 19 additions and 40 deletions
+9 -17
View File
@@ -69,25 +69,17 @@ fvm flutter build apk --release # build/app/outputs/flutter-apk/app-relea
fvm flutter build appbundle --release # build/app/outputs/bundle/release/app-release.aab
```
### Android Apple 로그인 — 빌드 옵션 두 개를 꼭 넣는다
### Android Apple 로그인 — 앱에 넣을 값 없음
Android 의 Apple 로그인은 iOS 와 달리 Apple 개발자 계정에 등록한 **서비스 ID** 와 **반환 주소**를
빌드 때 받아야 동작한다(`lib/features/auth/social_providers.dart` `appleWebAuthenticationOptionsFromEnvironment`).
둘 중 하나라도 비었거나 반환 주소가 `https://호스트` 꼴이 아니면 Apple 버튼이 비활성(「준비 중」)으로 남는다.
비밀값이 아니지만 환경별 값이라 저장소에 상수로 두지 않는다.
Android 는 Apple SDK 가 없어 Firebase 웹 흐름(`apple.com` 제공자 · `signInWithProvider`)으로 로그인한다.
값은 모두 콘솔에 둔다 — 빌드 옵션은 없다.
```bash
fvm flutter build apk --release \
--dart-define-from-file=config/kakao.env \
--dart-define=FANUZU_APPLE_SERVICE_ID=<서비스 ID> \
--dart-define=FANUZU_APPLE_REDIRECT_URI=<서비스 ID 에 등록한 Return URL>
```
- 값은 Apple 개발자 계정 「Identifiers → Services IDs」의 식별자와 그 「Sign in with Apple → Return URLs」 항목이다.
- 반환 주소가 Apple 응답을 앱으로 돌려보내야 한다 — `sign_in_with_apple` 패키지 규약대로
`intent://callback?<응답>#Intent;package=kr.co.fanuzu.app;scheme=signinwithapple;end` 로 넘기면
`AndroidManifest.xml` 의 `SignInWithAppleCallback`(scheme `signinwithapple`)이 받는다.
- 확인: 빌드한 APK 의 첫 화면에서 Apple 버튼이 눌리는지(비활성이면 옵션 누락).
1. Apple 개발자 계정 「Identifiers → Services IDs」에 서비스 ID 를 만들고 「Sign in with Apple」을 켠다.
- Domains: `<프로젝트 ID>.firebaseapp.com`
- Return URLs: `https://<프로젝트 ID>.firebaseapp.com/__/auth/handler`
2. 「Keys」에서 Sign in with Apple 키를 만들고 .p8 를 받는다(키 ID · 팀 ID 기록).
3. Firebase 콘솔 Authentication → 로그인 방법 → Apple 에 서비스 ID · 팀 ID · 키 ID · 비공개 키를 넣는다.
4. 확인: Android 첫 화면 Apple → 브라우저 탭에서 Apple 로그인 → 앱 HOME.
## 서명