Fireship · @fireship
Sign in with Apple from a Firebase Web App
Uploaded February 10, 2020 · Length 1:50
Summary
Implement Apple sign-in with Firebase in a web app using Apple Developer account and private key.
- apple sign in
- firebase authentication
- firebase web app
- apple developer account
- private key
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
sign-in with Apple was a feature
- 0:01
announced by Apple and 2019 and it
- 0:04
allows users to authenticate into a web
- 0:06
or mobile application using their Apple
- 0:08
ID it works just like other one-click
- 0:10
social sign-in methods like Google
- 0:11
Facebook Twitter etc to implement this
- 0:14
method in your firebase app you'll first
- 0:16
need to have an Apple Developer account
- 0:17
which will run you about $99 per year
- 0:19
now head over to your Apple developer
- 0:21
portal create a new app ID or update an
- 0:24
existing one to use the sign-in with
- 0:26
Apple capability from there you'll
- 0:28
create a new service ID and configure it
- 0:30
to work with your domain enter the
- 0:32
hosting URLs from your firebase project
- 0:34
then register the service ID now we need
- 0:36
to verify ownership of this domain with
- 0:38
Apple go back to the configuration for
- 0:40
the service ID you'll see the option to
- 0:42
download a file save that file under the
- 0:45
well-known directory in your public
- 0:46
hosting folder then upload this file to
- 0:49
firebase hosting by running firebase
- 0:50
deploy from the command line click
- 0:52
verify and you should get a green check
- 0:54
mark now the last thing we need is a
- 0:56
private key click on keys and then
- 0:58
generate a new one for Apple sign-in go
- 1:00
ahead and download this file somewhere
- 1:01
securely on your system then open it in
- 1:03
your editor at this point we can go to
- 1:05
the authentication tab on the firebase
- 1:07
console and click enable for Apple
- 1:09
sign-in enter your team ID as well as
- 1:11
the information from the private key and
- 1:13
now we just need to add a little bit of
- 1:15
JavaScript to our front-end app with
- 1:16
firebase initialized we'll make a
- 1:18
reference to auth then we'll define an
- 1:20
async function called sign in with Apple
- 1:22
it instantiates an auth provider for
- 1:24
apple calm then awaits the auth sign in
- 1:26
with pop-up method this prompts the user
- 1:28
to login with their Apple ID and when
- 1:30
they're done they'll be logged into the
- 1:32
firebase app and will have access to
- 1:34
their user data on the result this has
- 1:36
been Apple sign-in with firebase in 100
- 1:38
seconds and I realize that was super
- 1:39
fast so head over to fire ship IO to get
- 1:42
a full step-by-step breakdown of the
- 1:43
process thanks for watching make sure to
- 1:45
LIKE and subscribe and I will see you in
- 1:47
the next one


