-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore: update migration guide, Angular and React example apps on how to use FirebaseUI v7 without fetchSignInMethodsForEmail()
#1335
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
Open
russellwheatley
wants to merge
11
commits into
main
Choose a base branch
from
handle-different-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f7beb2c
chore: ignore .pnpm-store in .gitignore
russellwheatley 8159936
chore: update migration guide and React example app on workaround fet…
russellwheatley 20de54f
chore: update angular app
russellwheatley a508e99
chore: revert back auth emulator
russellwheatley 676d14f
fix: angular example not working as intended. now fixed
russellwheatley 379dd60
Apply suggestions from code review
russellwheatley fb73926
chore: format
russellwheatley aa41e6f
Update MIGRATION.md to show this is needed when email enumeration pro…
russellwheatley e3416ec
Merge branch 'main' into handle-different-provider
russellwheatley bfec2ae
chore: remove edge case documentation
russellwheatley c2953c8
docs: point to legacyFetchSignInWithEmail behavior
russellwheatley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ yarn-error.log* | |
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| .pnpm-store | ||
| node_modules | ||
| dist | ||
| dist-ssr | ||
|
|
||
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
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
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,150 @@ | ||
| /** | ||
| * Copyright 2025 Google LLC | ||
| * | ||
| * 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. | ||
| */ | ||
|
|
||
| import { Component, inject, OnInit, signal } from "@angular/core"; | ||
| import { CommonModule } from "@angular/common"; | ||
| import { Router } from "@angular/router"; | ||
| import { | ||
| AppleSignInButtonComponent, | ||
| FacebookSignInButtonComponent, | ||
| GitHubSignInButtonComponent, | ||
| GoogleSignInButtonComponent, | ||
| MicrosoftSignInButtonComponent, | ||
| TwitterSignInButtonComponent, | ||
| YahooSignInButtonComponent, | ||
| } from "@firebase-oss/ui-angular"; | ||
| import { PROVIDER_HINT_STORAGE_KEY, type StoredProviderHint } from "./sign-in-with-provider-tracking"; | ||
|
|
||
| const PROVIDER_DISPLAY_NAMES: Record<string, string> = { | ||
| "google.com": "Google", | ||
| "apple.com": "Apple", | ||
| "facebook.com": "Facebook", | ||
| "github.com": "GitHub", | ||
| "microsoft.com": "Microsoft", | ||
| "twitter.com": "Twitter / X", | ||
| "yahoo.com": "Yahoo", | ||
| }; | ||
|
|
||
| function getStoredHint(): StoredProviderHint | null { | ||
| try { | ||
| const raw = localStorage.getItem(PROVIDER_HINT_STORAGE_KEY); | ||
| return raw ? (JSON.parse(raw) as StoredProviderHint) : null; | ||
| } catch { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| @Component({ | ||
| selector: "app-provider-hint", | ||
| standalone: true, | ||
| imports: [ | ||
| CommonModule, | ||
| GoogleSignInButtonComponent, | ||
| AppleSignInButtonComponent, | ||
| FacebookSignInButtonComponent, | ||
| GitHubSignInButtonComponent, | ||
| MicrosoftSignInButtonComponent, | ||
| TwitterSignInButtonComponent, | ||
| YahooSignInButtonComponent, | ||
| ], | ||
| template: ` | ||
| @if (hint() && hint()!.providers.length > 0) { | ||
| <div class="max-w-sm mx-auto space-y-6"> | ||
| <div | ||
| class="rounded-lg border border-amber-200 bg-amber-50 dark:bg-amber-950/40 dark:border-amber-800 p-4 space-y-2" | ||
| > | ||
| <p class="text-sm font-semibold text-amber-800 dark:text-amber-200"> | ||
| Looks like you previously signed in with {{ providerNames() }}. | ||
| </p> | ||
| <p class="text-sm text-amber-700 dark:text-amber-300"> | ||
| Use the button below to sign in with the provider you used before. | ||
| </p> | ||
| </div> | ||
|
|
||
| <div class="space-y-2"> | ||
| @for (providerId of hint()!.providers; track providerId) { | ||
| @switch (providerId) { | ||
| @case ("google.com") { | ||
| <fui-google-sign-in-button (signIn)="onSignIn()" /> | ||
| } | ||
| @case ("apple.com") { | ||
| <fui-apple-sign-in-button (signIn)="onSignIn()" /> | ||
| } | ||
| @case ("facebook.com") { | ||
| <fui-facebook-sign-in-button (signIn)="onSignIn()" /> | ||
| } | ||
| @case ("github.com") { | ||
| <fui-github-sign-in-button (signIn)="onSignIn()" /> | ||
| } | ||
| @case ("microsoft.com") { | ||
| <fui-microsoft-sign-in-button (signIn)="onSignIn()" /> | ||
| } | ||
| @case ("twitter.com") { | ||
| <fui-twitter-sign-in-button (signIn)="onSignIn()" /> | ||
| } | ||
| @case ("yahoo.com") { | ||
| <fui-yahoo-sign-in-button (signIn)="onSignIn()" /> | ||
| } | ||
| } | ||
| } | ||
| </div> | ||
|
|
||
| <button | ||
|
Check failure on line 105 in examples/angular/src/app/screens/provider-hint.ts
|
||
| class="text-sm underline w-full text-center text-gray-500 dark:text-gray-400" | ||
| (click)="goBack()" | ||
| > | ||
| Back to sign in | ||
| </button> | ||
| </div> | ||
| } @else { | ||
| <div class="max-w-sm mx-auto space-y-4 text-center pt-12"> | ||
| <p class="text-sm text-gray-500 dark:text-gray-400"> | ||
| No provider hint found. Please sign in normally. | ||
| </p> | ||
| <button class="text-sm underline text-gray-600 dark:text-gray-300" (click)="goBack()"> | ||
| Back to sign in | ||
| </button> | ||
| </div> | ||
| } | ||
| `, | ||
| styles: [], | ||
| }) | ||
| export class ProviderHintComponent implements OnInit { | ||
| private router = inject(Router); | ||
|
|
||
| hint = signal<StoredProviderHint | null>(null); | ||
| providerNames = signal<string>(""); | ||
|
|
||
| ngOnInit(): void { | ||
| const stored = getStoredHint(); | ||
| this.hint.set(stored); | ||
| if (stored) { | ||
| this.providerNames.set( | ||
|
Check failure on line 135 in examples/angular/src/app/screens/provider-hint.ts
|
||
| stored.providers.map((id) => PROVIDER_DISPLAY_NAMES[id] ?? id).join(" or "), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| onSignIn(): void { | ||
| this.router.navigate(["/"]); | ||
| } | ||
|
|
||
| goBack(): void { | ||
| this.router.navigate(["/screens/sign-in-with-provider-tracking"]); | ||
| } | ||
| } | ||
|
|
||
| export default ProviderHintComponent; | ||
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.