이 코드가 실행되지 않는 이유를 잘 모릅니다. Firebase에서 필요한 모든 스 니펫을 복사하고 내 버튼이 실행 중입니다. 무엇이 잘못 될 수 있는지에 대한 아이디어가 있습니까? Github은 내가 여기서 여기에 더 많은 것들을 쓸 수있게 만들고있다.Firebase 인증
감사합니다.
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Auth</title>
<script src="https://www.gstatic.com/firebasejs/3.1.0/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-database.js"></script>
</head>
<body>
<button onclick="googleAuth()">SIGN UP</button>
<script>
var provider = new firebase.auth.GoogleAuthProvider();
var googleAuth = function() {
console.log(firebase);
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
};
</script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyBeJIaAAD5-vK0kBDTRH6Y6_1ByVE3erJY",
authDomain: "fir-chat-d28be.firebaseapp.com",
databaseURL: "https://fir-chat-d28be.firebaseio.com",
storageBucket: "fir-chat-d28be.appspot.com",
};
firebase.initializeApp(config);
</script>
</body>
브라우저에서 html 파일을보고 있으므로 firebase에 도메인을 추가 할 수 없습니다. 콘솔에서도 오류가 발생하지 않았습니다. – maxwellgover
브라우저에서 도메인이 무엇입니까? – Angelo
file : /// C : /Users/MGover/Desktop/index.html – maxwellgover