Android Apple 로그인을 Firebase 웹 흐름(apple.com 제공자)으로 연결 · 설정 안내
This commit is contained in:
@@ -50,9 +50,16 @@ class AuthRepository extends ChangeNotifier {
|
||||
/// 돌려준다.
|
||||
static List<SocialAuthProvider> _defaultProviders() => [
|
||||
const GoogleSignInProvider(),
|
||||
AppleSignInProvider(
|
||||
webAuthenticationOptions: appleWebAuthenticationOptionsFromEnvironment(),
|
||||
),
|
||||
// Android 는 Apple SDK 가 없어 Firebase 웹 흐름(`apple.com` 제공자)으로 간다 —
|
||||
// 서비스 ID · 키는 Firebase 콘솔 Apple 제공자 설정에 두고 앱에는 값이 없다.
|
||||
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android)
|
||||
const OidcSignInProvider(
|
||||
AuthProviderKind.apple,
|
||||
providerId: 'apple.com',
|
||||
scopes: ['email', 'name'],
|
||||
)
|
||||
else
|
||||
const AppleSignInProvider(),
|
||||
// 동의 항목은 카카오 콘솔 설정을 따른다(지금은 닉네임). 이메일(account_email)은 비즈 앱
|
||||
// 전환 후 콘솔에서 켜면 서버가 동의·인증된 값만 받는다.
|
||||
KakaoSignInProvider(),
|
||||
|
||||
@@ -482,25 +482,6 @@ Future<T> untilAbandoned<T>(
|
||||
});
|
||||
}
|
||||
|
||||
/// Apple Service ID와 callback URL은 비밀값이 아니지만 환경별 값이다.
|
||||
/// 저장소에 임시 상수를 박지 않고 빌드 시 `--dart-define`으로만 받는다.
|
||||
apple.WebAuthenticationOptions? appleWebAuthenticationOptionsFromEnvironment() {
|
||||
const clientId = String.fromEnvironment('FANUZU_APPLE_SERVICE_ID');
|
||||
const redirect = String.fromEnvironment('FANUZU_APPLE_REDIRECT_URI');
|
||||
if (clientId.isEmpty || redirect.isEmpty) return null;
|
||||
|
||||
final redirectUri = Uri.tryParse(redirect);
|
||||
if (redirectUri == null ||
|
||||
!redirectUri.hasScheme ||
|
||||
!redirectUri.hasAuthority) {
|
||||
return null;
|
||||
}
|
||||
return apple.WebAuthenticationOptions(
|
||||
clientId: clientId,
|
||||
redirectUri: redirectUri,
|
||||
);
|
||||
}
|
||||
|
||||
AuthAccount _toAccount(fb.User? user, SocialProvider provider) => AuthAccount(
|
||||
uid: user?.uid ?? '',
|
||||
provider: provider,
|
||||
|
||||
Reference in New Issue
Block a user