Firebase Bug Fix

This commit is contained in:
Georg Reisinger 2018-12-23 11:23:01 +01:00
parent acffe619b3
commit 6f0e230e10
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<script src="https://www.gstatic.com/firebasejs/5.7.0/firebase.js"></script>
<script >
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
authDomain: "test-667ca.firebaseapp.com",
databaseURL: "https://test-667ca.firebaseio.com",
projectId: "test-667ca",
storageBucket: "test-667ca.appspot.com",
messagingSenderId: "221332577314"
};
firebase.initializeApp(config);
console.log("EJS TEst: ", "<%= customtoken%>")
firebase.auth().signInWithCustomToken("<%= customtoken%>").then(function(response){
firebase.auth().getIdToken(/* forceRefresh */ ).then(function(idToken) {
console.log("IDTOKEN: ", idToken)
window.location.replace('/dash/'+ idToken);
}).catch(function(error) {
console.error("token error: ", error)
});
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.error("Custom token error: ", error.message)
});
</script>