Skip to content

Does signInWithIdToken support Facebook or not? #1259

@KiddoV

Description

@KiddoV

Describe the bug
I’m confused about whether signInWithIdToken supports Facebook.
According to the docs: https://supabase.com/docs/reference/dart/auth-signinwithidtoken

It mentions Facebook as one of the supported providers.
However, when I try using it, I get this error:

flutter: Error login with Facebook, AuthException(message: Provider must be google, apple, kakao or keycloak., statusCode: null, code: null)

My code:

///
Future<AuthResponse> facebookSignIn() async {
  // Use [package:flutter_facebook_auth] for more control of authentication flow
  try {
    final result = await FacebookAuth.instance.login(
      permissions: ["email", "public_profile"],
    );
    //
    if (result.status == LoginStatus.success) {
      final accessToken = result.accessToken!.tokenString;
      // Login to Supabase after successfully logging in with Facebook
      return Supabase.instance.client.auth.signInWithIdToken(
        provider: OAuthProvider.facebook,
        idToken: accessToken,
      );
    } else {
      throw Exception("Facebook login failed, ${result.status}");
    }
  } catch (err) {
    rethrow;
  }
}

supabase_flutter: ^2.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    authThis issue or pull request is related to authenticationbugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions