Notification texts go here Contact Us Telegram!
Posts

Login And Signup

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

 

Blogger me Login/Signup system directly support nahi karta, kyunki Blogger ek static platform hai jisme PHP, MySQL, ya server-side scripting ka support nahi hota. Lekin, tum Firebase Authentication ya Google OAuth ka use karke ek login system add kar sakte ho.


🔹 Method 1: Firebase Authentication (Recommended)

Firebase Google ka ek free authentication service hai jo Blogger jaisi websites me login system implement karne me madad karta hai.

🔥 Steps to Add Login/Signup in Blogger Using Firebase

  1. Firebase Project Create Karo:

    • Firebase Console par jao.
    • "Create Project" karo aur apni website ka naam do.
    • Authentication → Sign-in Method → Email/Password ya Google Sign-in enable karo.
  2. Firebase SDK Add Karo Blogger me:

    • Blogger Dashboard → Theme → Edit HTML me jao.
    • <head> tag ke andar 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>
    
  3. Firebase Config Code Add Karo:

    • Firebase Console → Project Settings → SDK Config code copy karo.
    • Blogger me <script> tag ke andar paste karo:
    <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>
    
  4. Login & Signup Buttons Add Karo:

    • Blogger me HTML/JavaScript widget ya theme me directly add karo:
    <button onclick="signUp()">Sign Up</button>
    <button onclick="signIn()">Login</button>
    <button onclick="signOut()">Logout</button>
    
    <script>
    function signUp() {
        var email = prompt("Enter Email:");
        var password = prompt("Enter Password:");
        firebase.auth().createUserWithEmailAndPassword(email, password)
        .then((userCredential) => alert("Signup Successful!"))
        .catch((error) => alert(error.message));
    }
    
    function signIn() {
        var email = prompt("Enter Email:");
        var password = prompt("Enter Password:");
        firebase.auth().signInWithEmailAndPassword(email, password)
        .then((userCredential) => alert("Login Successful!"))
        .catch((error) => alert(error.message));
    }
    
    function signOut() {
        firebase.auth().signOut().then(() => alert("Logged Out!"));
    }
    </script>
    
  5. Content Hide/Show Karo Login Ke Basis Par:

    • Agar tum chahte ho ki sirf logged-in users content dekhein, to ye code use karo:
    <div id="protected-content" style="display: none;">
        <h2>Welcome to My Website!</h2>
    </div>
    
    <script>
    firebase.auth().onAuthStateChanged((user) => {
        if (user) {
            document.getElementById("protected-content").style.display = "block";
        } else {
            document.getElementById("protected-content").style.display = "none";
        }
    });
    </script>
    

🔹 Method 2: Google OAuth (Easy But Limited)

Agar tum Firebase nahi use karna chahte, to Google OAuth ka simple login system Blogger me add kar sakte ho.

<div id="g-signin2"></div>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script>
function onSignIn(googleUser) {
    var profile = googleUser.getBasicProfile();
    alert("Welcome, " + profile.getName());
}
</script>

⚡ Drawback: Isme sirf Google Login hoga, email/password ka option nahi milega.


🎯 Conclusion:

  • Best Method: Firebase Authentication (Email, Google, Facebook sab support karta hai)
  • Easy Method: Google OAuth (Sirf Google se login hoga)
  • Alternative: Third-Party Authentication Services jaise Auth0 ya Okta use kar sakte ho.

Agar tum full authentication aur user management chahte ho, to Firebase best option 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.