-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Updated README docs for auth library, remove old auth library and sample. #2269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
40158ea
repository clean up
demolaf a392262
fix: extract email link
demolaf 389c0e2
remove unused Google config params
demolaf 3512daf
update README for auth
demolaf 61352ea
style: use scaffold for auth method picker internally
demolaf cd07267
update demo.gif
demolaf 342c59b
update README.md
demolaf 2c3a7d4
update README.md
demolaf b0894da
remove release process from notes
demolaf 834e7a7
maintain version 17 for java
demolaf fe601d4
fix ci
demolaf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,385 @@ | ||
| # Contributing to FirebaseUI-Android | ||
|
|
||
| <a href="https://github.com/firebase/FirebaseUI-Android/actions/workflows/android.yml"> | ||
| <img src="https://github.com/firebase/FirebaseUI-Android/workflows/Android%20CI/badge.svg" alt="Android CI GitHub Workflow Status"/> | ||
| </a> | ||
|
|
||
| _See also: [Firebase's code of conduct](https://firebase.google.com/support/guides/code-conduct)_ | ||
|
|
||
| ## 1. Things you will need | ||
|
|
||
| - Linux, Mac OS X, or Windows. | ||
| - [git](https://git-scm.com) (used for source version control). | ||
| - An ssh client (used to authenticate with GitHub). | ||
| - [Android Studio](https://developer.android.com/studio) or [IntelliJ IDEA](https://www.jetbrains.com/idea/). | ||
| - [JDK 21](https://adoptium.net/) or higher. | ||
| - [Android SDK](https://developer.android.com/studio) with minimum API level 21. | ||
|
|
||
| ## 2. Forking & cloning the repository | ||
|
|
||
| - Ensure all the dependencies described in the previous section are installed. | ||
| - Fork `https://github.com/firebase/FirebaseUI-Android` into your own GitHub account. If | ||
| you already have a fork, and are now installing a development environment on | ||
| a new machine, make sure you've updated your fork so that you don't use stale | ||
| configuration options from long ago. | ||
| - If you haven't configured your machine with an SSH key that's known to github, then | ||
| follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/) | ||
| to generate an SSH key. | ||
| - `git clone git@github.com:<your_name_here>/FirebaseUI-Android.git` | ||
| - `git remote add upstream git@github.com:firebase/FirebaseUI-Android.git` (So that you | ||
| fetch from the main repository, not your clone, when running `git fetch` | ||
| et al.) | ||
|
|
||
| ## 3. Environment Setup | ||
|
|
||
| FirebaseUI-Android uses Gradle to manage the project and dependencies. | ||
|
|
||
| The repository includes a `library/google-services.json` file that is copied to the app and test modules during builds. This is handled automatically by the build scripts. | ||
|
|
||
| To verify your environment is set up correctly, run: | ||
|
|
||
| ```bash | ||
| ./scripts/build.sh | ||
| ``` | ||
|
|
||
| This will: | ||
| - Copy the necessary `google-services.json` files | ||
| - Download all dependencies | ||
| - Build all modules | ||
| - Run checkstyle | ||
| - Run unit tests | ||
|
|
||
| > If you need to use your own Firebase project, replace `library/google-services.json` with your own configuration file from the [Firebase Console](https://console.firebase.google.com/). | ||
|
|
||
| ## 4. Running an example | ||
|
|
||
| The project provides a demo app in the `app` module which showcases the main use-cases of FirebaseUI Auth. | ||
|
|
||
| To run the example app: | ||
|
|
||
| **Option 1: Android Studio** | ||
| - Open the project in Android Studio | ||
| - Select the `app` configuration | ||
| - Run on a device or emulator | ||
|
|
||
| **Option 2: Command line** | ||
| ```bash | ||
| ./gradlew :app:installDebug | ||
| ``` | ||
|
|
||
| Then launch the app on your device. | ||
|
|
||
| Any changes made to the library modules (auth, database, firestore, storage) locally will be automatically reflected in the example application. | ||
|
|
||
| ## 5. Running tests | ||
|
|
||
| FirebaseUI-Android comprises of a number of tests, including unit tests and E2E tests. | ||
|
|
||
| ### Unit tests | ||
|
|
||
| Unit tests are responsible for ensuring expected behavior whilst developing the library's Kotlin/Java code. Unit tests do not | ||
| interact with 3rd party Firebase services, and mock where possible. To run unit tests for all modules (excluding e2eTest), run the following command from the root directory: | ||
|
|
||
| ```bash | ||
| ./gradlew testDebugUnitTest -x :e2eTest:testDebugUnitTest | ||
| ``` | ||
|
|
||
| To run unit tests for a specific module (e.g., auth): | ||
|
|
||
| ```bash | ||
| ./gradlew :auth:testDebugUnitTest | ||
| ``` | ||
|
|
||
| ### E2E tests | ||
|
|
||
| E2E tests run against Firebase Auth Emulator and test the full integration with Firebase services. To run e2e tests, you first need to start the Firebase Emulator: | ||
|
|
||
| ```bash | ||
| # Install Firebase Tools (if not already installed) | ||
| npm install -g firebase-tools | ||
|
|
||
| # Start the Firebase Auth Emulator | ||
| ./scripts/start-firebase-emulator.sh | ||
| ``` | ||
|
|
||
| Then in a separate terminal, run the e2e tests: | ||
|
|
||
| ```bash | ||
| ./gradlew e2eTest | ||
| ``` | ||
|
|
||
| > Note: E2E tests use Firebase Emulator Suite, so you don't need a real Firebase project to run them. | ||
|
|
||
| ### Lint and Code Analysis | ||
|
|
||
| To run lint checks: | ||
|
|
||
| ```bash | ||
| ./gradlew checkstyle | ||
| ``` | ||
|
|
||
| ## 6. Contributing code | ||
|
|
||
| We gladly accept contributions via GitHub pull requests. | ||
|
|
||
| Please peruse the | ||
| [Kotlin coding conventions](https://kotlinlang.org/docs/coding-conventions.html) and | ||
| [Android code style guide](https://developer.android.com/kotlin/style-guide) before | ||
| working on anything non-trivial. These guidelines are intended to | ||
| keep the code consistent and avoid common pitfalls. | ||
|
|
||
| To start working on a patch: | ||
|
|
||
| 1. `git fetch upstream` | ||
| 2. `git checkout upstream/master -b <name_of_your_branch>` | ||
| 3. Hack away! | ||
|
|
||
| Once you have made your changes, ensure that it passes the internal analyzer & formatting checks. The following | ||
| commands can be run locally to highlight any issues before committing your code: | ||
|
|
||
| ```bash | ||
| # Run the full CI build script | ||
| ./scripts/build.sh | ||
| ``` | ||
|
|
||
| This script runs: | ||
| - `./gradlew clean` | ||
| - `./gradlew assembleDebug` - Build all modules | ||
| - `./gradlew checkstyle` - Run code style checks | ||
| - `./gradlew testDebugUnitTest -x :e2eTest:testDebugUnitTest` - Run unit tests | ||
|
|
||
| You can also run these commands individually if needed. | ||
|
|
||
| Assuming all is successful, commit and push your code: | ||
|
|
||
| 1. `git commit -a -m "<your informative commit message>"` | ||
| 2. `git push origin <name_of_your_branch>` | ||
|
|
||
| To send us a pull request: | ||
|
|
||
| - `git pull-request` (if you are using [Hub](http://github.com/github/hub/)) or | ||
| go to `https://github.com/firebase/FirebaseUI-Android` and click the | ||
| "Compare & pull request" button | ||
|
|
||
| Please make sure all your check-ins have detailed commit messages explaining the patch. | ||
|
|
||
| When naming the title of your pull request, please follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) | ||
| guide. For example, for a fix to the FirebaseUI Auth module: | ||
|
|
||
| `fix(auth): fixed a bug with email sign-in!` | ||
|
|
||
| For a new feature: | ||
|
|
||
| `feat(auth): add support for passkey authentication` | ||
|
|
||
| Tests are run automatically on contributions using GitHub Actions. Depending on | ||
| your code contributions, various tests will be run against your updated code automatically. | ||
|
|
||
| Once you've gotten an LGTM from a project maintainer and once your PR has received | ||
| the green light from all our automated testing, wait for one of the package maintainers | ||
| to merge the pull request. | ||
|
|
||
| ### Code style | ||
|
|
||
| FirebaseUI-Android follows standard Kotlin and Android conventions: | ||
|
|
||
| #### Kotlin | ||
|
|
||
| - Use 4 spaces for indentation | ||
| - Maximum line length: 120 characters | ||
| - Use meaningful variable and function names | ||
| - Follow [Kotlin coding conventions](https://kotlinlang.org/docs/coding-conventions.html) | ||
|
|
||
| #### Jetpack Compose | ||
|
|
||
| - Follow [Compose API guidelines](https://github.com/androidx/androidx/blob/androidx-main/compose/docs/compose-api-guidelines.md) | ||
| - Composables should be stateless when possible | ||
| - Use `remember` for state that survives recomposition | ||
| - Hoist state when it needs to be shared | ||
|
|
||
| #### Example | ||
|
|
||
| ```kotlin | ||
| @Composable | ||
| fun SignInScreen( | ||
| configuration: AuthUIConfiguration, | ||
| onSignInSuccess: (AuthResult) -> Unit, | ||
| modifier: Modifier = Modifier | ||
| ) { | ||
| var email by remember { mutableStateOf("") } | ||
| var password by remember { mutableStateOf("") } | ||
|
|
||
| Column( | ||
| modifier = modifier | ||
| .fillMaxSize() | ||
| .padding(16.dp) | ||
| ) { | ||
| OutlinedTextField( | ||
| value = email, | ||
| onValueChange = { email = it }, | ||
| label = { Text("Email") }, | ||
| modifier = Modifier.fillMaxWidth() | ||
| ) | ||
|
|
||
| Spacer(modifier = Modifier.height(8.dp)) | ||
|
|
||
| OutlinedTextField( | ||
| value = password, | ||
| onValueChange = { password = it }, | ||
| label = { Text("Password") }, | ||
| visualTransformation = PasswordVisualTransformation(), | ||
| modifier = Modifier.fillMaxWidth() | ||
| ) | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Documentation | ||
|
|
||
| All public APIs should be documented with KDoc: | ||
|
|
||
| ```kotlin | ||
| /** | ||
| * Authenticates a user with email and password. | ||
| * | ||
| * @param email The user's email address | ||
| * @param password The user's password | ||
| * @return [AuthResult] containing the signed-in user | ||
| * @throws AuthException.InvalidCredentialsException if credentials are invalid | ||
| * @throws AuthException.NetworkException if network is unavailable | ||
| * | ||
| * Example usage: | ||
| * ```kotlin | ||
| * val result = authUI.signInWithEmailAndPassword( | ||
| * email = "user@example.com", | ||
| * password = "securePassword123" | ||
| * ) | ||
| * ``` | ||
| */ | ||
| suspend fun signInWithEmailAndPassword( | ||
| email: String, | ||
| password: String | ||
| ): AuthResult | ||
| ``` | ||
|
|
||
| ### Contributor License Agreement | ||
|
|
||
| You must complete the | ||
| [Contributor License Agreement](https://cla.developers.google.com/clas). | ||
| You can do this online, and it only takes a minute. | ||
| If you've never submitted code before, you must add your (or your | ||
| organization's) name and contact info to the [AUTHORS](AUTHORS) file. | ||
|
|
||
| ### License Headers | ||
|
|
||
| If you create a new file, do not forget to add the license header: | ||
|
|
||
| ```kotlin | ||
| /* | ||
| * Copyright 2025 Google Inc. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the | ||
| * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| ``` | ||
|
|
||
| ### The review process | ||
|
|
||
| Newly opened PRs first go through initial triage which results in one of: | ||
|
|
||
| - **Merging the PR** - if the PR can be quickly reviewed and looks good. | ||
| - **Closing the PR** - if the PR maintainer decides that the PR should not be merged. | ||
| - **Moving the PR to the backlog** - if the review requires non-trivial effort and the issue isn't a priority; in this case the maintainer will: | ||
| - Make sure that the PR has an associated issue labeled with "auth", "database", "firestore", or "storage". | ||
| - Add the "backlog" label to the issue. | ||
| - Leave a comment on the PR explaining that the review is not trivial and that the issue will be looked at according to priority order. | ||
| - **Starting a non-trivial review** - if the review requires non-trivial effort and the issue is a priority; in this case the maintainer will: | ||
| - Add the "in review" label to the issue. | ||
| - Self assign the PR. | ||
| - **API Changes** | ||
| - If a change or improvement will affect public API, the team will take longer in the review process. | ||
|
|
||
| ### The release process | ||
|
|
||
| We push releases manually, using Gradle and Maven publishing. | ||
|
|
||
| Changelogs and version updates are managed by project maintainers. The new version is automatically | ||
| generated via the commit types and changelogs via the commit messages. | ||
|
|
||
| Some things to keep in mind before publishing the release: | ||
|
|
||
| - Has CI run on the main commit and gone green? Even if CI shows as green on | ||
| the PR it's still possible for it to fail on merge, for multiple reasons. | ||
| There may have been some bug in the merge that introduced new failures. CI | ||
| runs on PRs as it's configured on their branch state, and not on tip of tree. | ||
| - [Publishing is | ||
| forever.](https://central.sonatype.org/publish/publish-guide/#deployment) | ||
| Hopefully any bugs or breaking changes in this PR have already been caught | ||
| in PR review, but now's a second chance to revert before anything goes live. | ||
| - "Don't deploy on a Friday." Consider carefully whether or not it's worth | ||
| immediately publishing an update before a stretch of time where you're going | ||
| to be unavailable. There may be bugs with the release or questions about it | ||
| from people that immediately adopt it, and uncovering and resolving those | ||
| support issues will take more time if you're unavailable. | ||
|
|
||
| ### Run a release... | ||
|
|
||
| 1. Switch to `master` branch locally. | ||
| 2. Run `git pull origin master`. | ||
| 3. Run `git pull --tags` to make sure all tags are fetched. | ||
| 4. Create new branch with the signature "release/[year]-[month]-[day]". | ||
| 5. Push your branch to git running `git push origin [RELEASE BRANCH NAME]`. | ||
| 6. Update version numbers in `gradle.properties`. | ||
| 7. Update `CHANGELOG.md` with release notes. | ||
| 8. Run `./gradlew assembleRelease` to verify the release builds. | ||
| 9. Run `git push origin [RELEASE BRANCH NAME]` & open pull request for review on GitHub. | ||
| 10. After successful review and merge of the pull request, switch to `master` branch locally, & run `git pull origin master`. | ||
| 11. Create and push a git tag: `git tag -a vX.Y.Z -m "Release X.Y.Z"` and `git push --tags`. | ||
| 12. Run `./gradlew publish` to publish to Maven Central. | ||
|
|
||
| ## 7. Contributing documentation | ||
|
|
||
| We gladly accept contributions to the SDK documentation. As our docs are also part of this repo, | ||
| see "Contributing code" above for how to prepare and submit a PR to the repo. | ||
|
|
||
| FirebaseUI-Android documentation lives in the README files for each module: | ||
| - `auth/README.md` - FirebaseUI Auth documentation | ||
| - `database/README.md` - FirebaseUI Realtime Database documentation | ||
| - `firestore/README.md` - FirebaseUI Firestore documentation | ||
| - `storage/README.md` - FirebaseUI Storage documentation | ||
|
|
||
| Firebase follows the [Google developer documentation style guide](https://developers.google.com/style), | ||
| which you should read before writing substantial contributions. | ||
|
|
||
| When updating documentation: | ||
|
|
||
| 1. Ensure code samples are tested and working | ||
| 2. Follow Markdown best practices | ||
| 3. Include screenshots or GIFs for UI-related changes | ||
| 4. Update table of contents if adding new sections | ||
| 5. Ensure links are valid and point to the correct locations | ||
|
|
||
| ## 8. Getting help | ||
|
|
||
| If you have questions about contributing: | ||
|
|
||
| - Check the module README files | ||
| - Check existing [issues](https://github.com/firebase/FirebaseUI-Android/issues) and [pull requests](https://github.com/firebase/FirebaseUI-Android/pulls) | ||
| - Ask on [Stack Overflow](https://stackoverflow.com/questions/tagged/firebaseui) with the `firebaseui` tag | ||
| - Create a new issue for discussion | ||
|
|
||
| ## 9. Recognition | ||
|
|
||
| Contributors will be recognized in: | ||
| - Release notes | ||
| - GitHub contributors page | ||
| - Project AUTHORS file | ||
|
|
||
| Thank you for making FirebaseUI-Android better! 🎉 | ||
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.