<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs" -->

---
title: Adding Firebase Authentication to a Jetpack Compose app
description: Part two of a series building an Android to-do app with Jetpack Compose walks through implementing Firebase Authentication, covering anonymous sign-in for...
canonical: https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Adding Firebase Authentication to a Jetpack Compose app | daily.dev
og:description: Part two of a series building an Android to-do app with Jetpack Compose walks through implementing Firebase Authentication, covering anonymous sign-in for...
og:url: https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs
og:image: https://api.daily.dev/og/posts/jD6EiamhS.png
og:image:alt: Adding Firebase Authentication to a Jetpack Compose app
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Firebase Authentication to a Jetpack Compose app

**[Firebase](https://daily.dev/sources/firebase-blog)** · 12 min read · 0 upvotes · 0 comments

## Summary

Part two of a series building an Android to-do app with Jetpack Compose walks through implementing Firebase Authentication, covering anonymous sign-in for frictionless onboarding, linking anonymous accounts to email/password credentials, and structuring the ViewModel and AccountService layers so composable functions stay free of business logic. Includes Gradle setup, code for LoginScreen and SettingsScreen state management, and callback-based Firebase API calls.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://firebase.blog/posts/2022/05/adding-firebase-auth-to-jetpack-compose-app>

## Questions this post answers

### How do I link an anonymous Firebase account to an email and password account in Android?

Use EmailAuthProvider.getCredential(email, password) to create a credential, then call Firebase.auth.currentUser!!.linkWithCredential(credential) with a completion listener. This upgrades the existing anonymous account instead of creating a new one, preserving the user's data such as their to-do items while adding permanent sign-in credentials.

_daily.dev surfaces practical Firebase auth patterns like this for developers wiring up account upgrades._

### How should I structure Firebase Authentication calls when using ViewModel and Jetpack Compose instead of an Activity?

Call Firebase Authentication methods from an AccountService accessed through the ViewModel rather than the Activity, using Firebase.auth directly without prior initialization and listeners that don't require a context. The Activity only creates the top-level composable, keeping business logic and API calls out of the UI layer entirely.

_developers designing clean Compose architectures track patterns like this via daily.dev._

## Similar posts on daily.dev

- [Kotlin / Wasm — Auth part 1: Google Sign in](https://daily.dev/posts/kotlin-wasm-auth-part-1-google-sign-in-dp1b4k1zm) · ProAndroidDev · 0 upvotes · 0 comments
- [Practical Kotlin Multiplatform: Implementing the Firebase Sign-up Operation with Ktor](https://daily.dev/posts/practical-kotlin-multiplatform-implementing-the-firebase-sign-up-operation-with-ktor-jddicwq8t) · Joe Birch · 0 upvotes · 0 comments
- [Android Account Security with Auth0 Universal Native Components](https://daily.dev/posts/android-account-security-with-auth0-universal-native-components-1domodcuy) · Auth0 · 0 upvotes · 0 comments

---

Tags: [#authentication](https://daily.dev/tags/authentication), [#kotlin](https://daily.dev/tags/kotlin), [#firebase](https://daily.dev/tags/firebase), [#jetpack-compose](https://daily.dev/tags/jetpack-compose), [#android-development](https://daily.dev/tags/android-development)

[View this post on daily.dev](https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Adding Firebase Authentication to a Jetpack Compose app","url":"https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs"},"datePublished":"2026-08-23T12:17:56.071Z","dateModified":"2026-08-23T12:26:16.934Z","description":"Part two of a series building an Android to-do app with Jetpack Compose walks through implementing Firebase Authentication, covering anonymous sign-in for...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7320f28ef8f2ec3995a60d8d039d63b7?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7320f28ef8f2ec3995a60d8d039d63b7?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Firebase","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Firebase","logo":"https://media.daily.dev/image/upload/s--i395oqZH--/f_auto,q_auto/v1787487448/logos/firebase-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/firebase-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"authentication,kotlin,firebase,jetpack-compose,android-development","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Firebase","item":"https://daily.dev/sources/firebase-blog"},{"@type":"ListItem","position":3,"name":"Adding Firebase Authentication to a Jetpack Compose app"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/adding-firebase-authentication-to-a-jetpack-compose-app-jd6eiamhs#faq","mainEntity":[{"@type":"Question","name":"How do I link an anonymous Firebase account to an email and password account in Android?","acceptedAnswer":{"@type":"Answer","text":"Use EmailAuthProvider.getCredential(email, password) to create a credential, then call Firebase.auth.currentUser!!.linkWithCredential(credential) with a completion listener. This upgrades the existing anonymous account instead of creating a new one, preserving the user's data such as their to-do items while adding permanent sign-in credentials. daily.dev surfaces practical Firebase auth patterns like this for developers wiring up account upgrades."}},{"@type":"Question","name":"How should I structure Firebase Authentication calls when using ViewModel and Jetpack Compose instead of an Activity?","acceptedAnswer":{"@type":"Answer","text":"Call Firebase Authentication methods from an AccountService accessed through the ViewModel rather than the Activity, using Firebase.auth directly without prior initialization and listeners that don't require a context. The Activity only creates the top-level composable, keeping business logic and API calls out of the UI layer entirely. developers designing clean Compose architectures track patterns like this via daily.dev."}}]}
```

