Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.
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
24 changes: 23 additions & 1 deletion firebase_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ const firebaseConfig = {
// Get a reference to the database service
var database = firebase.database();

githubSignIn=()=>{
var provider = new firebase.auth.GithubAuthProvider();
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a GitHub Access Token. You can use it to access the GitHub API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
console.log(error);
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
}

googleSignIn=()=>{
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider).then(function(result) {
Expand All @@ -32,4 +53,5 @@ const firebaseConfig = {
var credential = error.credential;
// ...
});
}
}

3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ <h1 style="margin-left: 30%;" id="mobile1">Login</h1>
<button type="button" onclick="googleSignIn()" class="btn btn-outline-primary btn-block google" style="margin-left: 25%;"><span class="text">Sign In with Google</span></button>
</div>
<div class="github-login">
<button type="submit" class="btn btn-outline-primary btn-block git" style="margin-left: 25%;"><span class="text">Sign In with Github</span></button>
<button type="button" onclick="githubSignIn()" class="btn btn-outline-primary btn-block git" style="margin-left: 25%;"><span class="text">Sign In with Github</span></button>
</div>

</form>
Expand Down Expand Up @@ -229,6 +229,5 @@ <h1 style="margin-left: 30%;" id="mobile1">Login</h1>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

</body>
</html>