xenial-black
xenial-black15mo ago

Firebase Auth after upgrade to 4.0 with remix

after upgrading to Refine 4 my authProvider is no more working with firebase auth. function
async function getCurrentFirebaseUser() {
return new Promise<FirebaseUser>((resolve, reject) => {
const unsubscribe = onAuthStateChanged(firebaseAuth, user => {
unsubscribe();
resolve(user as FirebaseUser | PromiseLike<FirebaseUser>);
}, reject);
});
}
async function getCurrentFirebaseUser() {
return new Promise<FirebaseUser>((resolve, reject) => {
const unsubscribe = onAuthStateChanged(firebaseAuth, user => {
unsubscribe();
resolve(user as FirebaseUser | PromiseLike<FirebaseUser>);
}, reject);
});
}
now always return null any ideas?
7 Replies
kapa.ai
kapa.ai15mo ago
Hey @vincentgraves! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
kapa.ai
kapa.ai15mo ago
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, I found this blog post (https://refine.dev/blog/refine-pixels-6/) which talks about user permissions with Supabase in Refine. It mentions that you can use Supabase Custom Claims to set up custom user roles. You can find more information about Supabase Custom Claims here (https://github.com/supabase-community/supabase-custom-claims). Hope this helps! ----------------------
Implementing Role Based Access Control | refine
We'll implement Role Based Access Control (RBAC)
kapa.ai
kapa.ai15mo ago
<@329697685902983181> kapa.ai is still learning and improving, please let us how it did by reacting below
Omer
Omer15mo ago
Hey @vincentgraves , Sorry for the issue. Could you check this section of the Migration Guide? https://refine.dev/docs/migration-guide/3x-to-4x/#authprovider
Migrating from 3.x.x to 4.x.x | refine
Motivation behind the release
xenial-black
xenial-black15mo ago
it works with legacy authProvider, but does not work in v4 with new routing etc actually I've didn't seen examples of how to use Firebase Auth with SSR without Firebase Admin, so now I'm unsure if the old behavior was correct seems like the old, v3 refine in example app used client-side authentication check and new example app uses server-side auth check, which is incompatible with firebase client libs
Omer
Omer15mo ago
Actually, there is no such difference between v3 and v4. Could you provide us with a reproducible CodeSandbox or StackBlitz environment for the issue? 👀
xenial-black
xenial-black15mo ago
I am not sure if the old behavior was correct. Firebase Admin is needed to use Firebase Auth with SSR, as described here: https://colinhacks.com/essays/nextjs-firebase-authentication