[컴] app 에서 firebase 사용하기

파이어베이스 / fire base /


Firebase 를 app 에서 사용하기

자세한 내용은 여기 를 참고 하자.
  1. firebase project 생성
  2. app 등록
    1. 앱 닉네임 등록 : 자신의 app 이름을 적자
    2. 그러면 아래 같은 code 를 얻게 된다.
  3. sdk 를 app 에 설치 후 initialize
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/6.6.2/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->

<script>
  // Your web app's Firebase configuration
  var firebaseConfig = {
    apiKey: "AsdfDQ3uOXYZp_MrNQPSauO4sdfsPn4OU8",
    authDomain: "coreal.firebaseapp.com",
    databaseURL: "https://coreal.firebaseio.com",
    projectId: "coreal",
    storageBucket: "",
    messagingSenderId: "997454353605",
    appId: "1:997454353605:web:5354b7543a6d9e68fdcad2"  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
</script>


관련 에러

app 등록을 안하면 아래같은 warning 이 보인다.

@firebase/database: FIREBASE WARNING: Provided authentication credentials for the app named "[DEFAULT]" are invalid. This usually indicates your app was not initialized correctly. Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.




댓글 없음:

댓글 쓰기