Skip to content

Support for Firebase Auth in Supabase via the SupabaseConnector #101

Open
@benoitletondor

Description

To connect to Supabase via a Firebase issued JWT, you need to use the createSupabaseClient method of SupabaseClientBuilder:

createSupabaseClient(
    supabaseUrl = BuildConfig.SUPABASE_URL,
    supabaseKey = BuildConfig.SUPABASE_ANON_KEY,
    builder = {
        this.accessToken = {
            Firebase.auth.currentUser?.getIdToken(false)?.await()?.token
        }

        install(Postgrest)
        // install(Auth) <-- This is not possible as you can't use the Auth plugin when using the custom AccessTokenProvider
    },
)

When doing so, you can't use the Auth plugin as you provide an AccessTokenProvider, this is a limitation of the SupabaseClient. Thus, you can't use the SupabaseConnector as it checks for the Auth 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions