-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Firebase Auth in Supabase via the SupabaseConnector
#101
Comments
We may support this in future but this is not currently on the roadmap. I will add an example of what could be implemented for future reference if other users come across this. Adapt the constructor to accept a // Constructor with custom Auth
public constructor(
supabaseUrl: String,
supabaseKey: String,
powerSyncEndpoint: String,
tokenProvider: suspend () -> String?,
) : this(
supabaseClient =
createSupabaseClient(supabaseUrl, supabaseKey) {
install(Postgrest)
accessToken = tokenProvider
},
powerSyncEndpoint = powerSyncEndpoint,
) and remove this check from require(supabaseClient.pluginManager.getPluginOrNull(Auth) != null) { "The Auth plugin must be installed on the Supabase client" } You will then need to adapt the other functions in the class to use your authentication method instead of |
There are many things not working afterwards though if you remove this check, as a lot of the mechanism for credentials in that class are relying on |
Here's an example of a connector that could be used without the additional helper functions:
|
To connect to Supabase via a Firebase issued JWT, you need to use the
createSupabaseClient
method ofSupabaseClientBuilder
:When doing so, you can't use the
Auth
plugin as you provide anAccessTokenProvider
, this is a limitation of theSupabaseClient
. Thus, you can't use theSupabaseConnector
as it checks for theAuth
plugin and crashes without it.Note that it's easy to bypass limitation by just copy/pasting the
SupabaseConnector
code and adapting it to my own codebase but it might be something you guys want to offer as a feature here.The text was updated successfully, but these errors were encountered: