Since you have already set up an authentication system with Firebase, you probably do not need to use ConnectyCube authentication module to manage passwords and users.
At least in my case, we do not need that functionality but we still must login to ConnectyCube to use their services.
After the user logs in, we can subscribe to one's state and retrieve the user object:
async function onAuthStateChanged(user) {
// we do different operations here
await connectyCube.configure(user);
}
useEffect(() => {
const subscriber = auth().onAuthStateChanged(onAuthStateChanged);
return subscriber; // unsubscribe on unmount
}, []);
In ConnectyCube.js:
configure = async user => {
/*
Here you can:
Do session login
check for the active session
Format the user
Try Catch different scenarios
Sign up a user
Check if a user exists
*/
ConnectyCube.users
.signup(user)
.then(user => {
console.log('[ConnectyCube.users signup]', user);
})
.catch(error => {
console.log(`%c[ConnectyCube.users signup] ${error}`, 'color: red');
});
};
Hope it gives some ideas