DEV Community

Cover image for Flutter Firebase Authentication: Apple Sign In

Flutter Firebase Authentication: Apple Sign In

Offline Programmer on February 17, 2021

As per Apple guidelines, apps that are offering sign in with other social services also need to provide the option of apple sign-in. I think it is ...
Collapse
 
tjgrapes profile image
Ashton Jones

Hey, good post.

I've been running into the following errors when I try to launch on a physical iOS device:
[core] Authorization failed: Error Domain=AKAuthenticationError Code=-7026 "(null)"

flutter: SignInWithAppleAuthorizationError(AuthorizationErrorCode.unknown, The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1000.))

And the following error when I try launching on an iOS simulator:
SignInWithAppleAuthorizationError(AuthorizationErrorCode.unknown, The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1000.))

I have everything set up correctly with Sign in With Apple capability and set the iOS deployment target to 13.

Any idea what is happening here?

Thanks

Collapse
 
offlineprogrammer profile image
Offline Programmer

Make sure to add "SignIn with Apple" capability in your plist file
Also if you are testing on a simulator, use a simulator of iOS 13.5 or lower...

Collapse
 
tjgrapes profile image
Ashton Jones • Edited

I got it working, I'm not sure exactly what the issue was.

I have the capability enabled in XCode, but don't see it in my plist file- what is the key value pair for sign in with apple in the plist file?

The following was generated in my Runner.entitlements file for Apple Sign In:


aps-environment
development
com.apple.developer.applesignin

Default


Do I still need the capability in the plist file?

Thread Thread
 
koketso_koks profile image
AppsByKoketso

Hi,

How did you fix the error.

I am getting the same error whilst running it on Real deveice and also on simulator

Collapse
 
paramo profile image
Paramo

Hello!! nice post!! Ive been doing the same but in the apple sign in screen after selected my email, full name and password a message appeared saying "login not completed" I tried to debug but no error show, its like it isnt making the validation. Any tips? im so stuck! Thank you! :)

Collapse
 
offlineprogrammer profile image
Offline Programmer

Are you testing on simulator? if yes, then try using a simulator of iOS 13.5 or lower...

Collapse
 
paramo profile image
Paramo

Thank you for your reply! I am testing on a physical device. I made it work now, I was missing on developer console, under Certificates, Identifiers & Profiles -> Keys. Adding the apple sign in key. I just did it on xcode but apparently wasnt enough

Thank you again and your post is so helpfull!

Thread Thread
 
offlineprogrammer profile image
Offline Programmer

Great...

Collapse
 
morteza_kolivand_4c554f06 profile image
Morteza Kolivand

Hi ,I could not run the code
For solutions, see dart.dev/go/unsound-null-safety
lib/authentication_provider.dart:37:16: Error: A non-null value must be returned since the return type 'User' doesn't allow null.
- 'User' is from 'package:firebase_auth/firebase_auth.dart' ('../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.1/lib/firebase_auth.dart').
Future signInWithApple() async {
^
Failed to package /Users/mortezakolivand/Desktop/Flutter Projects/AppleIdTest/appleidtest.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
Could not build the application for the simulator.
Error launching application on iPhone 12.

I have this error

Collapse
 
umutcoskun profile image
Umut Çağdaş Coşkun

Thanks, again.

Collapse
 
deepak_suthar_34a868a84af profile image
Deepak Suthar • Edited

this is good,
i want to get phone number use firebase apple login,
i calling function all data get but phone number is null,
"Your app requires users to provide their name phone number after using Sign in with Apple. This information is already provided by the Authentication Services framework. "
and my application are rejected,

after login with apple show this data,
User(displayName: null, email: **, isEmailVerified: true, isAnonymous: false, metadata: UserMetadata(creationTime: 2024-07-01 07:31:33.412Z, lastSignInTime: 2024-07-01 09:36:07.276Z), phoneNumber: null, photoURL: null, providerData, [UserInfo(displayName: null, email: *, phoneNumber: null, photoURL: null, providerId: apple.com, uid: "")], refreshToken: "")

how to solve this problem please help

Collapse
 
payal_godara_fbf6a8598428 profile image
Payal Godara

have you got the solution?

Collapse
 
umutcoskun profile image
Umut Çağdaş Coşkun

Thanks for the great article. You saved my day!

Collapse
 
647338bacbbb426 profile image
Ankur Saini

What should I do for sign Up Page not sign IN?

Collapse
 
skobe profile image
Aleksandr Skobeltcyn

I guess it will be the same, you just create user in firestore yourself with credential provided by Apple sign in

Collapse
 
offlineprogrammer profile image
Offline Programmer

You mean creating an Apple account? I don't think that is supported by Firebase.