Skip to content

Instantly share code, notes, and snippets.

@nikahmadz
Last active February 17, 2018 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikahmadz/b6ca880b413c9e86646d9a0d67ef3747 to your computer and use it in GitHub Desktop.
Save nikahmadz/b6ca880b413c9e86646d9a0d67ef3747 to your computer and use it in GitHub Desktop.
full firebase ui config
config={
callbacks:{
signInSuccess: function(currentUser, credential, redirectUrl) {
// Do something.
// Return type determines whether we continue the redirect automatically
// or whether we leave that to developer to handle.
return true;
},
signInFailure: function(error) {
// Some unrecoverable error occurred during sign-in.
// Return a promise when error handling is completed and FirebaseUI
// will reset, clearing any UI. This commonly occurs for error code
// 'firebaseui/anonymous-upgrade-merge-conflict' when merge conflict
// occurs. Check below for more details on this.
return handleUIError(error);
},
uiShown: function() {
// The widget is rendered.
// Hide the loader.
document.getElementById('loader').style.display = 'none';
}
},
credentialHelper: firebaseui.auth.CredentialHelper.ACCOUNT_CHOOSER_COM,
// Query parameter name for mode.
queryParameterForWidgetMode: 'mode',
// Query parameter name for sign in success url.
queryParameterForSignInSuccessUrl: 'signInSuccessUrl',
// Will use popup for IDP Providers sign-in flow instead of the default, redirect.
signInFlow: 'popup',
signInSuccessUrl: '<url-to-redirect-to-on-success>',
signInOptions: [
// Leave the lines as is for the providers you want to offer your users.
fba.GoogleAuthProvider.PROVIDER_ID,
fba.FacebookAuthProvider.PROVIDER_ID,
fba.TwitterAuthProvider.PROVIDER_ID,
fba.GithubAuthProvider.PROVIDER_ID,
fba.EmailAuthProvider.PROVIDER_ID,
{
provider: fba.EmailAuthProvider.PROVIDER_ID,
// Whether the display name should be displayed in the Sign Up page.
requireDisplayName: true
},
fba.PhoneAuthProvider.PROVIDER_ID
{
provider: fba.PhoneAuthProvider.PROVIDER_ID,
// Invisible reCAPTCHA with image challenge and bottom left badge.
recaptchaParameters: {
type: 'image',
size: 'invisible',
badge: 'bottomleft'
}
}
],
// Terms of service url.
tosUrl: '<your-tos-url>'
};
user.updateProfile({
displayName: "Jane Q. User",
photoURL: "https://example.com/jane-q-user/profile.jpg"
}).then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
user.updateEmail("user@example.com").then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
user.sendEmailVerification().then(function() {
// Email sent.
}).catch(function(error) {
// An error happened.
});
user.updatePassword(newPassword).then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
user.delete().then(function() {
// User deleted.
}).catch(function(error) {
// An error happened.
});
const credential = firebase.auth.EmailAuthProvider.credential(
user.email,
userProvidedPassword
);
user.reauthenticateWithCredential(credential).then(function() {
// User re-authenticated.
}).catch(function(error) {
// An error happened.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment