$("#form-login").submit(function(){ var email = $("#form-login input[name='username']").val() var password = $("#form-login input[name='password']").val()
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // ... }); firebase.auth().currentUser.getToken(/* forceRefresh */ true).then(function(idToken) { // Send token to your backend via HTTPS console.log(idToken) $.ajax({ type: "POST", url: "/authenticate", data: {"idToken": idToken}, dataType: "json", success: function(result){ console.log(result) } }); // ... }).catch(function(error) { // Handle error }); return false})app.post('/authenticate', function(req, res){ var idToken = req.body.idToken console.log(idToken)
firebase.auth().verifyIdToken(idToken).then(function(decodedToken) { var uid = decodedToken.uid; console.log(uid) // ... }).catch(function(error) { // Handle error console.log(error) });})To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/1bb8df36-9096-431c-b49a-fc5e92100f0e%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.