Sign in with Apple from a Firebase Web App

Sign in with Apple from a Firebase Web App

Sign in with Apple from a Firebase Web App - Learn how to Sign in with Apple from your Firebase web app in 100 seconds

Sign in with Apple was announced in 2019 and allows users to authenticate into your Firebase app with an Apple ID. Users must have two-factor authentication (2FA) enabled on their Apple account AND be signed into iCloud.

The following lesson demonstrates how to configure Apple SignIn with the Firebase JavaScript SDK.

Sign in with Apple Setup

Follow the steps outlined below to implement Sign In with Apple in your app.

Step 0 - Apple Developer Program

You must be a member of the Apple Developer Program. It costs $99 per year.

Step 1 - Create or Update an App ID

From the Apple Developer Portal go to Certificates, Identifiers & Profiles » Identifiers. Create a new App ID or update an existing app and give it the Sign In with Apple capability.

Make sure Sign In with Apple is Enabled

Step 2 - Create and Configure a Service ID

From Certificates, Identifiers & Profiles » Identifiers, create a new Service ID and make sure is linked to your primary App ID. Configure it point to your Firebase hosting URL.

Replace the project ID for your domain

Step 3 - Verify Domain Ownership

Go to Service ID you created in the previous step and click configure, then click download. Save the file in your web app’s public hosting directory under ./well-known/.

Deploy this file to your domain so Apple can verify it.

firebase deploy --only hosting

You should see a green checkmark next to the domain

Step 4 - Register a Private Key

From Certificates, Identifiers & Profiles » Identifiers, create and download a new private key - keep it private. It is used to validate requests from Apple with your Firebase project.

Download the private key. Do not expose it publicly.

Step 5 - Enable SignIn Method on Firebase

Head over the to the Firebase Console and go to the Authentication » Sign-in Method tab. Enable Apple and enter the required details.

Copy the contents of the private key in the console

Frontend Code

We now have all the pieces in place to implement SignIn with Apple into our web app. Because this is Firebase, it only requires a few lines of code. Assuming you have Firebase installed in your project, simply make a reference the the provider and call signInWithPopup().

SignIn with Apple popup seen by the end-user

Basic JavaScript Implementation

The frontend implementation is an async function that can bound to a button click to trigger the popup modal. Make sure to follow Apple UI guidelines when designing the button.

const auth = firebase.auth();

async signInWithApple() {
    const provider = new firebase.auth.OAuthProvider('apple.com');
    const result = await auth.signInWithPopup(provider);

    console.log(result.user); // logged-in Apple user
}

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

What’s new in HTML6

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Top iPad App Development Companies | Hire iPad App Developers

Top iPad App Development Companies | Hire iPad App Developers

An extensively researched list of top 10+ iPad app developers with ratings & reviews to help find the best custom iPad app development companies around the world. The essence of iOS is growing and TopDevelopers.co with detailed research and...

An extensively researched list of top 10+ iPad app developers with ratings & reviews to help find the best custom iPad app development companies around the world.

The essence of iOS is growing and TopDevelopers.co with detailed research and analysis renders the visitors all the major iPad app development companies. iPad along with the iPhone is a major medium of information for the companies to carry out their work and thus requires a lot of study and research to be done. But as tablets are replacing computers drastically, iPad app development continues to be leader, as iOS apps in it are highly optimized and provide the best possible results.

An extensively researched list of top iPad app developers with ratings & reviews to help find the best custom iPad app development companies around the world.

Check out List of Leading iPad App Development Agencies & iPad App Developers here.

Top Hybrid App Development Companies | Hire Hybrid App Developers | Reviews

Top Hybrid App Development Companies | Hire Hybrid App Developers | Reviews

An extensively researched list of top 10+ [hybrid app developers](https://www.topdevelopers.co/directory/mobile-app-developers/hybrid "hybrid app developers") with ratings & reviews to help find the best custom hybrid app development companies...

An extensively researched list of top 10+ hybrid app developers with ratings & reviews to help find the best custom hybrid app development companies around the world.

Are you searching for top Hybrid mobile app developers? We at TopDevelopers.co after extensive research have listed the Hybrid app development companies for your convenience.TopDevelopers also makes sure that this list includes the top-rated Hybrid mobile app developers. A full-featured cross-platform compatible app is not only ideal due to its cost-effectiveness but, it also reduces the time to market. However, the real challenge is to find an authentic Hybrid app development service provider. Bid adieu to all your worries, as TopDevelopers provides you with a list of internationally recognized Hybrid service providers. So, go ahead and hire from the best Hybrid developer for your dream Hybrid app project.

Let us check out the List of Leading Hybrid App Development Agencies & Hybrid App Developers.

ECommerce Mobile App Development | Ecommerce Mobile App Development Services

We are leading ecommerce mobile application development company. Hire our ecommerce mobile app developer for your custom Ecommerce project at competitive rates. **Know about [Top ECommerce Mobile App Development...

We are leading ecommerce mobile application development company. Hire our ecommerce mobile app developer for your custom Ecommerce project at competitive rates.

Know about Top ECommerce Mobile App Development Company