Notification texts go here Contact Us Telegram!
Posts

Steps to Add Google Login in Firebase (Blogger ke liye bhi kaam karega)

Learna Academy
Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated

 

Agar tum chahte ho ki users Google Account se Login ya Signup karein, to tum Firebase Authentication ka Google Sign-In enable kar sakte ho.


🔥 Steps to Add Google Login in Firebase (Blogger ke liye bhi kaam karega)

1️⃣ Firebase Console me Google Sign-In Enable Karo

  1. Firebase Console par jao.
  2. Apne project ko select karo ya naya project banao.
  3. Authentication → Sign-in method section me jao.
  4. Google Sign-In select karo aur Enable button daba do.
  5. Save kar do.

2️⃣ Firebase SDK aur Config Code Blogger me Add Karo

Blogger ya HTML page ke <head> section me ye Firebase scripts add karo:

<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.6.1/firebase-auth.js"></script>
<script>
const firebaseConfig = {
    apiKey: "YOUR_API_KEY",
    authDomain: "YOUR_PROJECT_ID.firebaseapp.com",
    projectId: "YOUR_PROJECT_ID",
    storageBucket: "YOUR_PROJECT_ID.appspot.com",
    messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
    appId: "YOUR_APP_ID"
};
firebase.initializeApp(firebaseConfig);
</script>

3️⃣ Google Login Button Ka Code Add Karo

Blogger me ya kisi HTML file me ye button aur script add karo:

<button onclick="googleSignIn()">Google Se Login Karo</button>
<button onclick="signOut()">Logout</button>

<script>
function googleSignIn() {
    var provider = new firebase.auth.GoogleAuthProvider();
    firebase.auth().signInWithPopup(provider)
    .then((result) => {
        var user = result.user;
        alert("Welcome, " + user.displayName);
    })
    .catch((error) => {
        alert("Login Failed: " + error.message);
    });
}

function signOut() {
    firebase.auth().signOut().then(() => {
        alert("Logged Out Successfully!");
    });
}
</script>

🎯 Features:

Google Account se direct Login/Signup ho jayega
User ka Name, Email, Profile Photo fetch kar sakte ho
Firebase Authentication me automatically user add ho jayega
Blogger ya kisi bhi static website me easily kaam karega

Agar tum full authentication system banana chahte ho, to Google + Email/Password dono support karne ka option bhi hai! 🚀

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.