Skip to content

Authentication Anonymous Authentication

Eoin Landy edited this page Jan 30, 2020 · 2 revisions

The contents of this page are based on the original Firebase Documentation

You can use Firebase Authentication to create and use temporary anonymous accounts to authenticate with Firebase. These temporary anonymous accounts can be used to allow users who haven't yet signed up to your app to work with data protected by security rules. If an anonymous user decides to sign up to your app, you can link their sign-in credentials to the anonymous account so that they can continue to work with their protected data in future sessions.

Before you begin

  1. If you haven't yet connected your app to your Firebase project, do so from the Firebase console.
  2. Enable anonymous auth:
    • In the Firebase console, open the Auth section.
    • On the Sign-in Methods page, enable the Anonymous sign-in method.

Authenticate with Firebase anonymously

When a signed-out user uses an app feature that requires authentication with Firebase, sign in the user anonymously by completing the following steps:

auth.signInAnonymously(onSignedIn);

private function onSignedIn(error:AuthError):void {
    var user:FirebaseUser = auth.currentUser;
    trace(user.isAnonymous); //true
});
Clone this wiki locally