Adding/using multiple supabase data providers
Is it possible to use multiple(two) supabase data providers with one being used as an authentication provider aswell.
When trying to specify which data provider to use, refine seems to always default to the supabase client thats used for the auth even when I specify the correct data provider to use using the dataProviderName prop on the useTable hook and resource property
5 Replies
Hi @Awelani. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, it is possible to use multiple Supabase data providers in Refine, including one being used as an authentication provider. You can specify which data provider to use by utilizing the
dataProviderName
prop in your data hooks and components.
Here is a step-by-step guide to achieve this:
1. Define Multiple Data Providers:
You need to define multiple data providers in your Refine configuration. For example, you can have a default data provider and another one for specific resources.
2. Specify Data Provider in Hooks:
When using data hooks, you can specify which data provider to use by passing the dataProviderName
prop.
3. Authentication Provider:
Ensure that your authentication provider is correctly set up and linked to the appropriate Supabase client.
4. Using Data Provider in Components:
When using components like forms or tables, ensure you specify the correct data provider.
By following these steps, you should be able to use multiple Supabase data providers in your Refine application, with one being used for authentication and others for different resources.
For more detailed information, you can refer to the following documentation:
- Data Provider Usage (https://refine.dev/docs/data/data-provider/#usage-1)
- useTable Hook (https://refine.dev/docs/data/hooks/use-many/#dataprovidername)
- Auth Provider (https://refine.dev/docs/authentication/auth-provider/)
If you encounter any issues, ensure that the dataProviderName
is correctly specified and that the data providers are properly configured in your Refine setup.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1227314902184628346> kapa.ai is still learning and improving, please let us know how it did by reacting below
vicious-gold•2mo ago
So seems like the order in which the supabase client is created is what determines which supabase data provider is used
@kapa.ai So seems like the order in which the supabase client is created is what determines which supabase data provider is used
Let me check the knowledge base for you. One moment! :books:
----------------------
The order in which the Supabase client is created does not necessarily determine which Supabase data provider is used. Instead, you can explicitly specify which data provider to use by utilizing the
dataProviderName
prop in your data hooks and components.
Here’s a detailed explanation and example to clarify:
Step-by-Step Guide
1. Define Multiple Data Providers:
You need to define multiple data providers in your Refine configuration. For example, you can have a default data provider and another one for specific resources.
2. Specify Data Provider in Hooks:
When using data hooks, you can specify which data provider to use by passing the dataProviderName
prop.
3. Authentication Provider:
Ensure that your authentication provider is correctly set up and linked to the appropriate Supabase client.
4. Using Data Provider in Components:
When using components like forms or tables, ensure you specify the correct data provider.
Conclusion
By explicitly specifying the dataProviderName
in your hooks and components, you can control which Supabase data provider is used, regardless of the order in which the Supabase clients are created.
For more detailed information, you can refer to the following documentation:
- Data Provider Usage (https://refine.dev/docs/data/data-provider/#usage-1)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1227314902184628346> kapa.ai is still learning and improving, please let us know how it did by reacting below