Struggling with Development Plugin and Authentication Flow

Hi there,
I am struggling with a developing plugin to use firebase authentication because attached picture error happened.
I am not sure why this error happened.

Here is my goal.

  • I would like to use firebase authentication instead of bubble signup/login.

Here is my plugin information and code

field : Email/Password
property : firebase initialize information

function(properties, context) {	
   let email = properties.email;
   let password = properties.password;
   control result status
   let result;
   const firebaseConfig = {
      apiKey: context.apiKey["apiKey"],
      authDomain: context.authDomain["authDomain"],
      projectId: context.projectId["projectId"],
      storageBucket: context.storageBucket["storageBucket"],
      messagingSenderId: context.messagingSenderId["messagingSenderId"],
      appId: context.appId["appId"]
   };

   // process initialize firebase
   initializeFirebase(firebaseConfig);
   
   // process authentication
   authFirebase(email, password, result);
   return result;     
}

// function for initialize firebase
function initializeFirebase(firebaseConfig){
    import { initializeApp } from 'firebase/app';
    const app = initializeApp(data);
    return app;
}
    
// function for process authentication
function authFirebase(email, password, result){
    import { getAuth, signInWithEmailAndPassword } from "firebase/auth";
    const auth = getAuth();
    signInWithEmailAndPassword(auth, email, password).then((userCredential) => {
        const user = userCredential.user;
        result = "yes";
        return result;
      })
      .catch((error) => {
        const errorCode = error.code;
        const errorMessage = error.message;
        result = "no"
        return result;
      });
    
}

I checked using node because I have to use some firebase modules, and I build a package.json including dependency : firebase.

Please advice me if you have any ideas.

Thank you!!

Hi there,
I have one question about status control after using outside authentication.

I wonder how all plugins switch status and how they control status.

Here are my images.

  • All plugins can use two databases which mean an internal(bubble) database and an outside(MySQL, Firebase, AWS Cognito) database/authentication feature to authenticate users.
  • If a plugin uses an outside database/authentication feature to use outside authentication, it will change status in an internal database after authentication.

If you have a building experience to use outside authentication such as Firebase or AWS Cognito, please share your solution and idea with us.
Thank you!!

This topic was automatically closed after 70 days. New replies are no longer allowed.