I did some stuff wrong, sorry and please ignore this
~Thanks in advance for all your work, first of all. I am submitting these changes in order to achieve a specific behavior regarding redirect URLs that I think should be supported by this package.~
~Summary~
~Support the use of redirectTo option in supabase client to use custom redirect URLs after signing in with OAuth providers. The same redirectTo property in supabaseAuthProvider arguments works for Set and Reset password flows.~
~Problem~
~This is the case I was dealing with:~
~Using an OAuth provider (such as Google).~
~The need to implement different authentication flows across the application (one for customers and another for administrators).~
~Placing react-admin root component (<Admin authProvider={...}>...</Admin>) in a custom route (such as /admin) different from /.~
~If all of these conditions are true, the react-admin authentication provider will fail to complete the authentication flow, since the access and refresh tokens never get to the Admin component as expected. Since the supabase client uses the SITE_URL by default, and the customer authentication flow needs it to be set to the root URL of the web application, it is impossible to use an alternative authentication flow using ra-supabase, as it will try to redirect to the root URL instead of the custom admin URL.~
~Solution~
~Allowing the developer to set an additional string property redirectTo in SupabaseAuthProviderOptions and using its value as a parameter when calling signInWithOAuth, as it is described in the Supabase documentation.~
~Additionally, the same value can be used to achieve this behavior in the set-password flow.~
~Notes~
~Feel free to leave a comment if you feel I can fix anything, especially with the set-password case. Since I am only using the OAuth flow, I don't actually need to set or reset passwords, so I haven't been able to test those flows too much.~
I did some stuff wrong, sorry and please ignore this
~Thanks in advance for all your work, first of all. I am submitting these changes in order to achieve a specific behavior regarding redirect URLs that I think should be supported by this package.~
~Summary~
~Support the use of
redirectTo
option insupabase
client to use custom redirect URLs after signing in with OAuth providers. The sameredirectTo
property insupabaseAuthProvider
arguments works for Set and Reset password flows.~~Problem~
~This is the case I was dealing with:~
react-admin
root component (<Admin authProvider={...}>...</Admin>
) in a custom route (such as/admin
) different from/
.~~If all of these conditions are true, the
react-admin
authentication provider will fail to complete the authentication flow, since the access and refresh tokens never get to theAdmin
component as expected. Since thesupabase
client uses theSITE_URL
by default, and the customer authentication flow needs it to be set to the root URL of the web application, it is impossible to use an alternative authentication flow usingra-supabase
, as it will try to redirect to the root URL instead of the custom admin URL.~~Solution~
~Allowing the developer to set an additional string property
redirectTo
inSupabaseAuthProviderOptions
and using its value as a parameter when callingsignInWithOAuth
, as it is described in the Supabase documentation.~~Additionally, the same value can be used to achieve this behavior in the
set-password
flow.~~Notes~
~Feel free to leave a comment if you feel I can fix anything, especially with the
set-password
case. Since I am only using the OAuth flow, I don't actually need to set or reset passwords, so I haven't been able to test those flows too much.~