programing

화이트리스트에 있는 링크에 대해 Firebase에서 "도메인이 화이트리스트에 없음"으로 표시됨

closeapi 2023. 6. 10. 09:08
반응형

화이트리스트에 있는 링크에 대해 Firebase에서 "도메인이 화이트리스트에 없음"으로 표시됨

전자 메일 마법 링크를 사용하여 Firebase 인증을 설정하고 여기에 있는 가이드를 사용하느라 바쁩니다.

https://firebase.google.com/docs/auth/android/email-link-auth

도메인을 화이트리스트에 추가해야 한다고 표시되지만 콘솔에서 만든 동적 링크 외에 이를 수행할 위치를 찾을 수 없습니다.아래 코드를 실행하려고 했지만 다음 코드가 표시됩니다.

[ URNAUTHIZED_DOMAIN: 프로젝트에서 화이트리스트에 없는 도메인 ]

    val actionCodeSettings = ActionCodeSettings.newBuilder()
            // URL you want to redirect back to. The domain (www.example.com) for this
            // URL must be whitelisted in the Firebase Console.
            .setUrl("https://myapphere.page.link/register") //I created this dynamic link in the firebase console
            .setHandleCodeInApp(true)
            .setAndroidPackageName(
                    "com.myapphere",
                    true, 
                    "1")
            .build()

    val auth = FirebaseAuth.getInstance()
    auth.sendSignInLinkToEmail(email, actionCodeSettings)
            .addOnCompleteListener(this) { task ->
                if (task.isSuccessful) {
                    // Sign in success, update UI with the signed-in user's information
                } else {
                    // If sign in fails, display a message to the user.
                }
            }

파이어베이스 인증에 동적 링크를 사용하면 안 되나요?만약 그렇다면, 화이트리스트 도메인을 찾을 수 없기 때문에 콘솔의 어디에서 화이트리스트 도메인을 사용할 수 있습니까?

  1. Firebase 콘솔로 이동
  2. 인증 메뉴 > 로그인 방법 탭 클릭
  3. 권한 있는 도메인으로 아래로 스크롤
  4. 도메인 추가 단추를 누른 후 도메인을 추가하고(파라미터가 있는 웹 사이트 도메인) "추가"를 누릅니다.

이 페이지에서 더 아래로 스크롤

저도 같은 문제가 있었습니다. 그 이유는 Firebase에서 구성된 제 SHA-1 키가 잘못되었기 때문입니다.

에 가다https://console.firebase.google.com/project/<project-id>/authentication/settings

인증된 도메인을 누릅니다.

도메인 추가를 클릭합니다.

여기에 이미지 설명 입력

자세한 정보:이 문제는 제가 시도했을 때 발생합니다.sendSignInLinkToEmail이것처럼.

firebase
  .auth()
  .sendSignInLinkToEmail('someone@example.com', {
    url: 'my.custom.domain',
    handleCodeInApp: true
});

Firebase 호스팅에서 기본 도메인을 사용하는 경우 사용자 지정 도메인을 추가하기 전까지는 괜찮습니다.

이 문제는 사용자 정의 도메인을 에 추가하여 해결할 수 있습니다.Authorized Domains인증에서 -> 로그인 방법 -> 인증된 도메인

이 오류를 극복하려면 다음을 수행해야 했습니다.

    const actionCodeSettings = {
    ¦ // URL you want to redirect back to. The domain (www.example.com) for this
    ¦ // URL must be in the authorized domains list in the Firebase Console.
    ¦ url: 'https://example.com',
    ¦ handleCodeInApp: true,
    };

그 다음에 추가example.com그리고.www.example.com인증된 도메인으로 이동합니다.

언급URL : https://stackoverflow.com/questions/51374411/firebase-says-domain-not-whitelisted-for-a-link-that-is-whitelisted

반응형