Apple Sign-In in Flutter

Updated 27 April 2023

Save

Apple Sign-In in Flutter helps to integrate Apple Sign-In for iOS Users in the app. Social Login is very common nowadays. Everyone prefers to sign up for the Applications with the help of a Social Login.

It reduces the amount of time a user spends filling out the details in order to Create an Account.

Our Flutter app development company also provides various Social Login compatibility with your app.

There are several types of Social Login supported by Flutter –

Steps for Integrating Apple Sign-In in Flutter on Firebase Console

Firstly, we will need to enable “Apple Sign In” on Firebase Console.

Step-1 –> Go To “Firebase Console“. Select your Project.

Step-2 –> Click on “Authentication” from the Drawer Menu

Step-3 –> Now, click on “Sign-in method” Tab.

Step-4 –> Here, you will find all the types of authentication which Firebase supports.

We have to select “Apple” and enable it.

Steps to Enable Apple Sign-In in Flutter through Apple Developer Account

Secondly, we will have to also configure “SignIn with Apple” from Apple Developer Account.

Step-1 –> Go to Apple Developer Account and select “Certificates, Identifiers and Profiles”.

Step-2 –> Now, go to Identifiers and select the Identifier linked with your app.

Step-3 –> Select “Sign In with Apple” within the identifier and “Save” it.

Step-4 –> Once you have enabled Sign In with Apple from Apple Developer Account, now you will have to add it in the Xcode Capability Section.

Once we are done with it, we are all set to write our code.

Step-1 –> Firstly, we will need to add the dependency in our pubspec.yaml file

After adding the dependency, run ‘pub get‘ command.

Step-2 –> Now, we will create an Apple Sign In Button which is provided by the dependency.

Here, we have “type” property which specifies what type of button you want signin,default or continue.

“onPressed” will be used to execute the function.

There are some other properties like cornerRadius, style etc.

Apple SignIn is not supported by all the devices so we also need to add a check in order to determine that the SignIn with Apple will work or not on a particular device.

Here, we have added a check for AppleSignIn supported devices and after that if AppleSignIn is supported by the device we have requested for the Email and FullName value.

We can also initialize the Scope Value as per the need with the help of Scope.rawValue(value)

After adding this, now we also have to handle the cases whether the user has logged in successfully or not or is there any exception.

For this we can define some cases, on the basis of the status of login result.

The output of the code is –

Conclusion

In this blog, we have discussed about Apple SignIn in Flutter.

I hope it will help you out in understanding and get a brief idea about it.

Here’s our blog on Google Sign-In in Flutter – https://mobikul.com/google-sign-in-in-flutter/

Thank you for reading!!

References 

https://medium.com/smartters-studio/flutter-login-with-apple-3a98582f53a1

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • seta
    • Tanya Goel (Moderator)
  • Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home