我正在尝试遵循这里的教程:https://www.youtube.com/watch?v=ny92vcpOQFs...but我收到一个400错误,返回消息“找不到API密钥。请传递有效的API密钥”。
提供API密钥的代码部分是从GCP Identity Platform接口直接复制的,我已经检查了多次。
我不知道从哪里开始,所有的教程都认为这是理所当然的。
最小复制如下所示,但如果我尝试使用firebase-ui-auth,则会得到相同的结果:
<!DOCTYPE html>
<html>
<head>
<title>Identity Platform Test</title>
<script src="https://www.gstatic.com/firebasejs/8.0/firebase.js"></script>
<script> //this section copied directly from GCP
var config = {
apiKey: '<Private but 100% correct>',
authDomain: 'my-site.firebaseapp.com',
};
firebase.initializeApp(config);
</script>
<script>
let email = 'private@gmail.com';
let pw = 'private';
firebase
.auth()
.signInWithEmailAndPassword(email, pw)
.then((ac) => {
console.log('It worked.');
})
.catch((error) => {
console.log(error.toString());
});
</script>
</head>
<body>
Test
</body>
</html>