search

Home  >  Q&A  >  body text

Firebase Error: Workaround requiring options (app/no-options) when deploying to hosting without source

<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粉587780103P粉587780103446 days ago564

reply all(1)I'll reply

  • P粉198670603

    P粉1986706032023-09-02 08:07:08

    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>

    reply
    0
  • Cancelreply