Firebase Error: Workaround requiring options (app/no-options) when deploying to hosting without source
P粉587780103
P粉587780103 2023-09-01 09:49:32
0
1
568
<p>I'm trying to implement a basic Google login on a simple HTML page but for some reason it doesn't work and gives me the error in the header. This is just the basic popup login functionality you can find in the Firebase documentation, I have a button </p> <p><code><button class="w-100 btn btn-lg btn-success" id="g_sign" onclick="signInWithPopup">Sign in with Google</button> < /code> This is a basic Bootstrap button with an onclick attribute that calls signinwithpopup</p> <pre class="brush:php;toolbar:false;">const auth = getAuth(); signInWithPopup(auth, provider) .then((result) => { // This will give you a Google access token. You can use it to access Google API. const credential = GoogleAuthProvider.credentialFromResult(result); const token = credential.accessToken; // Login user information. const user = result.user; // Use getAdditionalUserInfo(result) to obtain IdP data // ... }).catch((error) => { // Handle errors. const errorCode = error.code; const errorMessage = error.message; // The email of the user account to use. const email = error.customData.email; //The AuthCredential type used. const credential = GoogleAuthProvider.credentialFromError(error); // ... });</pre> <p>I tried adding const app in the auth constant but it didn't work, hope someone can help! <code>const auth = getAuth(app);</code></p> <p>I'm trying to add a Google Authentication provider using Firebase Authentication, so I followed the documentation instructions and expected to see a simple popup asking me which Google account to use, but it didn't do that instead is throwing an error in the console. I've also looked at solutions to other people's questions here, but none of them seem to work. </p>
P粉587780103
P粉587780103

reply all(1)
P粉198670603

I think this is because you used onclick, and you should use onClick with the first letter capitalized.

<button class="w-100 btn btn-lg btn-success" id="g_sign" onClick="signInWithPopup">使用Google登录</button>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template