Firebase Authentication Extension

Firebase Authentication Extension

Simple Firebase Auth is a compact Firebase Authentication extension for MIT App Inventor and Niotron, providing Firebase Authentication through Google's Identity Toolkit REST API, along with classic Google Sign-In.

The extension is designed around a simple success/failure event system, so multiple authentication operations can be handled using a small and clean blocks surface.

:sparkles: Features

:locked_with_key: Email & Password

  • Sign in with email and password

  • Create a new Firebase account

  • Local failed-login protection with configurable lockout

:bust_in_silhouette: Anonymous Authentication

  • Sign in anonymously

  • Useful for guest users and temporary accounts

:blue_circle: Google Sign-In

  • Opens the Google account picker

  • Supports Firebase Web Client ID

  • Automatically exchanges the Google ID token with Firebase

  • Returns the Firebase authentication result through the same AuthSuccess / AuthFailed system

:counterclockwise_arrows_button: Automatic Token Refresh

Firebase ID tokens normally expire after one hour. Simple Firebase Auth can automatically refresh the token before expiration when auto-refresh is enabled.

Auto-refresh is enabled by default after a successful authentication.

:floppy_disk: Persistent Sessions

The extension stores the authentication session locally and provides:

  • TryAutoLogin()

  • IsSignedIn

  • CurrentUserId

  • CurrentEmail

  • CurrentIdToken

TryAutoLogin() can restore a fresh stored session immediately or refresh an expired ID token when a refresh token is available.

:e_mail: Password & Email Management

Through ManageAccount():

  • Send password reset email

  • Send email verification

  • Change password

  • Update display name

  • Update profile photo URL

  • Fetch fresh user information

  • Delete the Firebase account

:shield: Login Attempt Protection

SignInWithEmail() includes a configurable local brute-force guard.

You can configure:

  • Maximum failed attempts

  • Base lockout duration

  • Automatic token refresh

The lockout duration increases with repeated lockout streaks and is capped by the implementation. This is a client-side convenience/protection layer, while Firebase's own authentication protection remains the actual security boundary.

:satellite_antenna: Clean Authentication Events

Instead of having separate success/failure events for every authentication operation, the extension uses two primary events:

AuthSuccess

Returns:

  • action

  • uid

  • email

  • idToken

AuthFailed

Returns:

  • action

  • reasonCode

  • message

  • isRetryable

This allows the same event blocks to handle sign-in, sign-up, Google Sign-In, auto-login, token refresh and account-management operations.

:warning: Stable Error Codes

AuthFailed provides documented reason codes so you don't have to depend on Firebase's raw error strings.

Examples include:

  • WRONG_CREDENTIALS

  • USER_NOT_FOUND

  • ACCOUNT_DISABLED

  • EMAIL_ALREADY_IN_USE

  • WEAK_PASSWORD

  • INVALID_EMAIL

  • TOO_MANY_ATTEMPTS

  • NO_SESSION

  • REAUTH_REQUIRED

  • SESSION_EXPIRED

  • NETWORK_ERROR

  • CANCELLED

  • NO_ID_TOKEN

  • NOT_FOUND

  • UNKNOWN_ACTION

  • UNKNOWN

:puzzle_piece: Main Functions

  • SetApiKey()

  • Configure()

  • TryAutoLogin()

  • RefreshIdToken()

  • SignOut()

  • SignInWithEmail()

  • CreateUserWithEmail()

  • SignInAnonymously()

  • SignInWithGoogle()

  • SignOutGoogle()

  • ManageAccount()

:pushpin: Properties

  • IsSignedIn

  • CurrentUserId

  • CurrentEmail

  • CurrentIdToken

  • CurrentDisplayName

  • CurrentPhotoUrl

  • CurrentEmailVerified

  • IsLockedOut

  • SecondsUntilUnlocked

:satellite_antenna: Additional Events

  • GoogleIdTokenReceived

  • UserInfoReceived

  • LockedOut

:gear: REST-Based Firebase Authentication

For Firebase authentication operations, the extension communicates directly with Google's Identity Toolkit REST endpoints using HttpURLConnection, instead of relying on the native FirebaseAuth SDK.

Google authentication uses Google's classic GoogleSignInClient / GoogleSignInOptions API.

:mobile_phone: Designed For

MIT App Inventor • Niotron • Android Apps

Built with Java + Fast CLI. :heart:


:inbox_tray: Download

Simple Firebase Auth Extension:

simpleAuth.aix (1.5 MB)