Skip to content

[firebase_auth] Support for an auth provider with identifier 'apple.com' is not implemented. #1794

@AmitaiMazliah

Description

@AmitaiMazliah

Describe the bug
I'm trying to implement login with apple with firebase
I'm using https://pub.dev/packages/apple_sign_in
To get the apple cred, than I'm passing the creds to firebase but I'm getting an error

I have enabled apple login in the firebase console

To Reproduce
Steps to reproduce the behavior:
this is my code

import 'dart:async';
import 'package:apple_sign_in/apple_sign_in.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'dart:convert' show utf8;

class UserRepository {

  static final UserRepository _instance =  UserRepository._internal();
  factory UserRepository() => _instance;

  UserRepository._internal({FirebaseAuth firebaseAuth})
      : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance;

  Future<void> signInWithApple() async {
    final AuthorizationResult result = await AppleSignIn.performRequests([
      AppleIdRequest(requestedScopes: [Scope.email, Scope.fullName])
    ]);
    AuthCredential credential = OAuthProvider(providerId: "apple.com").getCredential(
        idToken: utf8.decode(result.credential.identityToken)
    );
    return _firebaseAuth.signInWithCredential(credential);
  }
}

I'm getting the cred back from apple, than I'm creating firebase AuthCredential successfully.
I'm getting an exception on this line
_firebaseAuth.signInWithCredential(credential);

This is the exception log:

Credential: Authorization Credential:
 UID: 000999.926e6af69be040daa4fb63d5f62a6053.1958 
 Identity Token: {length = 752, bytes = 0x65794a72 61575169 4f694a42 53555250 ... 79326437 6d724941 } 
 AuthorizationCode: {length = 63, bytes = 0x63366634 38303663 62316234 64343536 ... 78484175 34687867 } 
 User Verification Result: 0 
 User Info: <AKUserInformation: 0x600001bc8370 {
	givenName: Amitai,
	familyName: Mazliah,
	forwardingEmail: (null),
	accountName: (null),
	accountAliases: (null),
	reachableEmails: (null),
	authorizedApplicationsListVersion: (null),
	masterKeyID: (null),
	vettedPrimaryEmail: (null),
    credential =     {
        authorizationCode = "<FlutterStandardTypedData: 0x600002c01040>";
        authorizedScopes =         (
        );
        email = "amitaimazliah@gmail.com";
        fullName =         {
            familyName = Mazliah;
            givenName = Amitai;
            middleName = "<null>";
            namePrefix = "<null>";
            nameSuffix = "<null>";
            nickname = "<null>";
        };
        identityToken = "<FlutterStandardTypedData: 0x600002c00380>";
        realUserStatus = 1;
        state = "<null>";
        user = "000999.926e6af69be040daa4fb63d5f62a6053.1958";
    };
    credentialType = ASAuthorizationAppleIDCredential;
    status = authorized;
}
Support for an auth provider with identifier 'apple.com' is not implemented.
Lost connection to device.


```After the exception the app crashes.

**Expected behavior**
Firebase allow the user to login and create a new user if it doesn't exsists yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked: customer-responseWaiting for customer response, e.g. more information was requested.plugin: authresolution: needs-reproThis issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin.type: documentationImprovements or additions to documentationtype: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions