Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions firebase.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- Firebase JavaScript SDK -->
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-auth.js"></script>
33 changes: 33 additions & 0 deletions firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/ Import the necessary Firebase modules
import firebase from 'firebase/app';
import 'firebase/auth';

// Initialize Firebase (Make sure you have already set up your Firebase project)
const firebaseConfig = {
// Your Firebase config object goes here
};
firebase.initializeApp(firebaseConfig);

// Get the Firebase auth instance
const auth = firebase.auth();

// Create a Google authentication provider
const provider = new firebase.auth.GoogleAuthProvider();

// Function to handle Google sign-in
function signInWithGoogle() {
auth.signInWithPopup(provider)
.then((result) => {
// Successful authentication
const user = result.user;
console.log('Authenticated user:', user);
})
.catch((error) => {
// Failed authentication
console.log('Authentication failed:', error.message);
});
}

// Call the signInWithGoogle function when the login button is clicked
const loginButton = document.getElementById('login-button');
loginButton.addEventListener('click', signInWithGoogle);