javascriptfirebase-authenticationfirebaseui

how do I set firebase auth ui disableSignUp correctly?


i'm new to a lot of webdev and firebase. I'm using firebase auth for my webapp (javascript) and would like to disable the option for new user creations. i've found this: https://github.com/firebase/firebaseui-web#configure-email-provider

and tried implementing it like this:

var uiConfig = {
    callbacks: {
        signInSuccessWithAuthResult: function(authResult, redirectUrl) {
            return true;
        },
        uiShown: function() {
            document.getElementById('loader').style.display = 'none';
        }
    },
    // Will use popup for IDP Providers sign-in flow instead of the default, redirect.
    signInFlow: 'popup',
    signInSuccessUrl: 'index.html',
    signInOptions: [{
        provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
        requireDisplayName: false,
        disableSignUp: true
    }],
    // Terms of service url.
    tosUrl: '<your-tos-url>',
    // Privacy policy url.
    privacyPolicyUrl: '<your-privacy-policy-url>'
};

Under singInOptions, I've added disableSignUp: true, but I guess my syntax is wrong? Any help is appreciated.


Solution

  • I also read the update article you mentioned. I also tried hard to correctly use the disableSignUp variable. Here is how I did it, and it worked:

    var uiConfig = {
        signInSuccessUrl: "/",
        signInOptions: [{
            provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
            requireDisplayName: false,
            disableSignUp: {
                status: true,
                adminEmail: "",
                helpLink: "https://www.example.com/trouble_signing_in",
            }
        }]
    }