Fireship · @fireship
Anonymous Authentication with Angular and Firebase - Lazy Registration
Uploaded April 19, 2017 · Length 2:40
Summary
build anonymous auth with angular and firebase for lazy registration
- angular anonymous auth
- firebase lazy registration
- angularfire package
- anonymous authentication
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
in this episode we're going to build an
- 0:02
anonymous authorization service with
- 0:04
angular 4 and fire-based this feature
- 0:07
will allow user to start using your app
- 0:09
without going through the typical ooofff
- 0:11
sign end or email password registration
- 0:14
process this approach is also called
- 0:16
lazy registration or gradual engagement
- 0:20
it works by creating a session using
- 0:22
only the user ID if the user signs out
- 0:26
without updating more account details
- 0:27
they will be unable to log back in and
- 0:30
retrieve any data that they created at
- 0:33
this point it's assumed that you have
- 0:34
the angularfire to package installed and
- 0:36
bootstrapped in your application if not
- 0:39
good at the docs or check out this video
- 0:41
if starting from scratch generate the
- 0:45
office service I'm actually going to be
- 0:47
building upon the all service from my
- 0:49
previous the last tutorial so I
- 0:51
recommend checking out that video first
- 0:53
if you haven't already head over to your
- 0:55
firebase project and enable the
- 0:58
anonymous provider first make sure to
- 1:04
subscribe to the firebase off state in
- 1:06
the constructor then write a function to
- 1:09
login the user with the anonymous
- 1:11
provider and let's also add a typescript
- 1:14
getter to see if a user who's currently
- 1:17
logged in is anonymous or not this will
- 1:20
be useful when displaying content
- 1:21
specifically for anonymous users in the
- 1:24
template
- 1:27
now we can inject the service into our
- 1:30
components to login users and
- 1:31
automatically in this case we just bind
- 1:34
the function to the click event of any
- 1:36
button or length in the template when
- 1:41
the anonymous user decides to upgrade
- 1:43
you'll need to transfer the account data
- 1:45
to a new account or somehow link the two
- 1:48
accounts together the firebase Web API
- 1:51
supports account linking but in order to
- 1:54
do this you would need to bypass the
- 1:56
angularfire to package is an alternative
- 1:59
you can simply create a new account and


