I am working on a log in for a web application, and I have made it so the user can sign in manually with their email and password or by using a google sign in. Is there a way to
Currently @mjdnk asnwer depracated, because it will gives always first provider not the last logged in.
So most recent solution is:
As noted here
var uiConfig = {
callbacks: {
signInSuccessWithAuthResult: function(authResult, redirectUrl) {
var providerId = authResult.additionalUserInfo.providerId;
localStorage.setItem("firebaseProviderId", providerId)
//...
},
//..
}
and for display in page
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
user.getIdToken().then(function (idToken) {
$('#user').text(welcomeName + "(" + localStorage.getItem("firebaseProviderId")+ ")");
$('#logged-in').show();
}
}
});