Authentication Firebase - issue with the code #120729
Replies: 4 comments 1 reply
-
|
Hi @JackBowa, Thank you for being a part of the GitHub community! You can use GitHub Discussions any time your have a programming related question, like this one or explore our other categories to learn more about GitHub. I highly recommend that you deactivate your current API key and create a new one as soon as possible, as you have exposed it in your code above. Firebase is a backend service so you will have to set up your website / project to handle backend functionality, which you can't do with HTML scripts. I found this in their documentation that might be useful to you: Get Started with Firebase Authentication on Websites. May I ask why you decided to use Firebase? If you are just beginning with learning backend - looking into how to use the MERN Stack to store data and authenticate users may be more beginner friendly! |
Beta Was this translation helpful? Give feedback.
-
|
Hi @ebndev, Many thanks for your message, I have deleted the Firebase application (due to the API Key). I took Firebase following the comments find on internet to be honest, so I will have a look for MERN Stack ! Thanks again for your time. |
Beta Was this translation helpful? Give feedback.
-
|
Hi and welcome 👋—first of all, respect for jumping into web development from scratch. Everyone starts as a “noob,” so you’re on the right path already. Regarding your issue: the main problem is that you’re mixing Firebase v9+ (modular SDK) with the old v8 namespaced syntax. In Firebase 10, objects like firebase.auth() no longer work the way they used to, which is why clicking the button does nothing—no error, no action. You have two clear options: Option 1 (Easiest for beginners): Option 2 (Recommended long-term): Also, make sure: Google sign-in is enabled in Firebase Authentication Your domain is added under Authorized domains You are serving the page over https (required for auth popups) Once authentication works, you can easily link user accounts to comments on your manga reviews—whether it’s for general content or popular series people read like Jjk manga online, user interaction will add a lot of value to your site. Keep going—you’re asking the right questions, and that’s how real progress happens 💪 |
Beta Was this translation helpful? Give feedback.
-
|
The main reason your buttons aren't doing anything is just a version mixup. Firebase recently changed how their code works in Versions 9 and 10, but the code you wrote is in the older Version 8 style. The quickest fix, without making you rewrite everything, is to use the compatibility versions of the scripts. Also, you're currently missing the line that actually tells the app to start up using your settings. Try swapping out your script tags and the initialization part with this: <script src="https://www.gstatic.com/firebasejs/10.11.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.11.0/firebase-auth-compat.js"></script>
<script>
firebase.initializeApp(firebaseConfig);
</script>A couple of quick tips for you: First, the Console is your best friend. On your test page, right click and hit Inspect, then click the Console tab. If a button doesn't work, it'll usually spit out a red error message there telling you exactly what's broken. Second, double check that you enabled Google Login. Go into your Firebase Dashboard, click on Authentication, then Sign in method, and make sure Google is actually toggled on. If it's not enabled there, the code won't have permission to log anyone in. Don't sweat the noob status. Every single one of us has spent hours wondering why a button wasn't working only to realize we missed one tiny line of code. Give that a shot and see if it gets that popup moving! If you see any red errors in the console, just paste them here and I can help you figure out what to do next. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Dear all,
I'm a new member on GitHub, and I'm trying to create a website to share my personal reviews of manga and manhwas with other people. The site I'm working on is called mangainsight.com. My biggest challenge is that I'm developing this website without knowledge or experience in web development. Although I've learned a lot about coding while creating the website, I'm still a noob.
On this site, I'd like to enable users to write comments below my reviews so that they can share their thoughts about the manga. However, to make this possible, I need to allow users to create personal accounts. I'm planning to use Firebase Authentication, so I created an application on the Firebase console and added some code to a new HTML page. Unfortunately, nothing happens when I click the button. Could someone please help me figure out what might be wrong?
Here's a link to the test page where I'm experiencing the issue: mangainsight.com/test.html.
I tried to have a look on the previous discussion but I did not find anything, It’s possible that I don’t fully understand how the community / discussion in Github works.
I apologize for any mistakes in my English, and I thank you in advance for your help and advice!
Beta Was this translation helpful? Give feedback.
All reactions