Apple login in Android (With Firebase)

Updated 29 November 2020

Save

In today’s scenario, social login is used to authenticate users in a speedy way in comparison to normal form filling registration and authentication. Most of the apps consider google, Facebook, Twitter etcetera as a social login platform. In this blog, we learn how apple login works in android to authenticate users in-app.

As we are doing apple login with firebase, so we need to add firebase auth dependency inside app-level Gradle

Next, we need to enable the apple login in the firebase auth section. (assuming that you have registered your project on firebase and add a google-service.json file in the project)

We have to register our project on the apple developer console for the successful implementation of apple login and do the following steps:

  1. Associate your website to your app on the apple console and when the dialog prompt registers the following URL as return URL  –  https://YOUR_FIREBASE_PROJECT_ID.firebaseapp.com/__/auth/handler. (You can get this URL from the apple signing method)


2.  Then you need to verify ownership of the redirect domain that you mention in the first step. For this, you need to download a file and temporary host on the following URL – https://YOUR_FIREBASE_PROJECT_ID.firebaseapp.com/.well-known/apple-developer-domain-association.txt 

After the completion of the registration process, we can move further for the code at the application end.

Create the instance of the OAuth provider with the provider id(apple.com)

Unlike other firebase auth, apple login will take control of your UI by opening a Custom Chrome Tabs, so you are not able to handle the onSuccess() or onFailure() method to render UI for the application. You need to check whether you’ve already received a response or not. To check there is already a pending result available call the getPendingAuthResult() method:

After getting the user details you can send the details in the Rest API for the login process in the app. This is how we can manage the apple login in the android application.

I hope, this blog is helpful for you.

Also, check the following link: Apple login in android

author
. . .

Leave a Comment

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


Be the first to comment.

Start a Project


    Message Sent!

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

    Back to Home