このコードが実行されていない理由がわかりません。 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