我希望在我的Firebase项目中使用Google登录按钮;但是当我点击Google登录按钮时,出现以下错误:Uncaught Error: Illegal url for new iframe。
这是我的代码:
TY FOR YOUR HELP.
这是我的代码:
TY FOR YOUR HELP.
firebase.initializeApp({
apiKey: '***',
authDomain: 'https://***.firebaseapp.com',
projectId: '***'
});
var ui = new firebaseui.auth.AuthUI(firebase.auth());
var uiConfig = {
callbacks: {
signInSuccessWithAuthResult: function(authResult, redirectUrl) {
return true;
},
uiShown: function() {
document.getElementById('loader').style.display = 'none';
}
},
signInFlow: 'popup',
signInSuccessUrl: 'https://***.web.app/',
signInOptions: [
firebase.auth.GoogleAuthProvider.PROVIDER_ID
],
// Terms of service url.
tosUrl: 'https://***.web.app/',
// Privacy policy url.
privacyPolicyUrl: 'https://***.web.app/'
};
ui.start('#firebaseui-auth-container', uiConfig);
<script src="https://www.gstatic.com/firebasejs/7.4.0/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/ui/4.8.0/firebase-ui-auth.js"></script>
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/4.8.0/firebase-ui-auth.css" />
<h1>Welcome to My Awesome App</h1>
<div id="firebaseui-auth-container"></div>
<div id="loader">Loading...</div>
process.env
中存储的值被放在引号中。移除引号解决了这个问题。 - Gustavo Santamaría