worthy-azureW
Refine2y ago
4 replies
worthy-azure

Proper way to use AuthProvider with Supabase

Hello, I’m new with Refine and I’m just playing with the AuthProvider and Supabase.

I think I could make it working just like the tutorial https://refine.dev/blog/refine-pixels-6/#refineweek-series

But I have a couple of question:

I notice that getPermission is called a lot and is hitting the database constantly. Is there a way to get the role directly from the …auth-token in localstorage? It’t safe to save the role in a custom localstorage? Something like the example https://refine.dev/docs/authentication/auth-provider/#getpermissions. For example the user could change it manually and get any permission, maybe this need additional work with RLS validation from the Supabse side?

And another thing with the Pixels 6 tutorial, is that while getPermission is calling, the buttons are enabled and the user can click on them. Just after the response in getPermission the buttons are disabled.

Thanks
Auth provider is an object that contains methods to handle authentication and access control in your app by having Refine consume them. These methods expect to return a promise, so they can be used with async methods.
Auth Provider | Refine
We'll implement Role Based Access Control (RBAC)
Implementing Role Based Access Control | Refine
Was this page helpful?