-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.js
33 lines (30 loc) · 1.3 KB
/
git.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.8.1/firebase-app.js";
import { getAuth,GithubAuthProvider,signInWithPopup } from "https://www.gstatic.com/firebasejs/10.8.1/firebase-auth.js"
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyBzpENwuyX-uO7yzikMfXkxl-nQln_kMtI",
authDomain: "spotify-bb627.firebaseapp.com",
projectId: "spotify-bb627",
storageBucket: "spotify-bb627.appspot.com",
messagingSenderId: "291038167718",
appId: "1:291038167718:web:bb2c9b60ee4216fa23ea67"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
auth.languageCode = 'en';
const provider = new GithubAuthProvider();
const githubLogin = document.getElementById("github-login-btn");
githubLogin.addEventListener("click",function() {
signInWithPopup(auth, provider)
.then((result) => {
const credential = GithubAuthProvider.credentialFromResult(result);
const user = result.user;
}).catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
});
})