Hesapları Bağlama ve Sağlayıcı Yönetimi
Kimlik doğrulama sağlayıcılarını bağlayıp ayırarak, çakışmaları yöneterek ve bağlı kimlik bilgilerini güvenle idare ederek tek bir kullanıcının birden çok giriş yöntemiyle tek bir hesaba sahip olmasını sağlayın.
Hesapları Bağlama ve Sağlayıcı Yönetimi, CoddyKit'te ücretsiz bir Firebase Auth & Realtime Database Apps dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Firebase Auth & Realtime Database Apps öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Firebase Auth & Realtime Database Apps kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
The Multi-Provider Problem
The same person may sign in with email/password today and Google tomorrow. Without linking, Firebase could treat these as two separate accounts.
Account linking unifies multiple sign-in methods under one Firebase user (one uid).
How Linking Works
Linking attaches an additional credential to the currently signed-in user. The user keeps the same uid and data, but gains a new way to log in.
- Email/password can be linked to a social account
- Multiple social providers can coexist
Linking a Provider
Use linkWithPopup on the current user to add another provider interactively.
import { getAuth, GoogleAuthProvider, linkWithPopup } from 'firebase/auth';
const user = getAuth().currentUser;
await linkWithPopup(user, new GoogleAuthProvider());
console.log('Google linked to existing account');Linking a Credential Directly
When you already hold a credential (for example email/password the user just typed), use linkWithCredential.
import { EmailAuthProvider, linkWithCredential } from 'firebase/auth';
const cred = EmailAuthProvider.credential(email, password);
await linkWithCredential(getAuth().currentUser, cred);The Collision Error
If the new provider's email already belongs to a different account, Firebase throws auth/account-exists-with-different-credential. This is the key case you must handle.
Resolving a Collision
To resolve it: read the conflicting email, ask the user to sign in with the existing provider, then link the new credential onto that account.
import { fetchSignInMethodsForEmail } from 'firebase/auth';
const methods = await fetchSignInMethodsForEmail(auth, email);
// prompt user to sign in with methods[0], then link pendingCredInspecting Linked Providers
The user object exposes providerData, an array describing every linked provider. Use it to render a 'connected accounts' settings screen.
const user = getAuth().currentUser;
user.providerData.forEach(p => console.log(p.providerId));Unlinking a Provider
Let users disconnect a method with unlink, passing the provider ID. Always keep at least one sign-in method so the account stays accessible.
import { unlink } from 'firebase/auth';
await unlink(getAuth().currentUser, 'google.com');Guarding the Last Provider
Before unlinking, check that more than one provider remains. Removing the only method would orphan the user.
const user = getAuth().currentUser;
if (user.providerData.length <= 1) {
showError('You must keep at least one sign-in method.');
return;
}Reauthentication for Sensitive Changes
Linking or unlinking is a sensitive operation. If the user's session is old, Firebase may require recent login and throw auth/requires-recent-login. Reauthenticate before retrying.
import { reauthenticateWithPopup } from 'firebase/auth';
await reauthenticateWithPopup(user, new GoogleAuthProvider());Design Considerations
Plan your identity model up front:
- Treat email as the unifying key when possible
- Surface linked accounts in user settings
- Always handle the collision error gracefully
Quick Check
Test your understanding of account linking.
Recap
You can now unify identities across providers.
- Link with
linkWithPopuporlinkWithCredential - Handle
account-exists-with-different-credential - Inspect
providerDataand unlink safely - Always keep at least one provider
- Reauthenticate for sensitive changes
Yapay zeka eğitmeniyle Firebase Auth & Realtime Database Apps öğren — ücretsiz
Tarayıcında gerçek kod yaz ve çalıştır, 7/24 yapay zeka eğitmeninden anında yardım al; web'de ya da uygulamada kaldığın yerden devam et.
- Kurslar
- 11
- Dersler
- 44
Sıkça Sorulan Sorular
“Hesapları Bağlama ve Sağlayıcı Yönetimi” dersi ücretsiz mi?
Evet — “Hesapları Bağlama ve Sağlayıcı Yönetimi” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Firebase Auth & Realtime Database Apps kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Firebase Auth & Realtime Database Apps kursu toplamda 4 dersten oluşur.
“Hesapları Bağlama ve Sağlayıcı Yönetimi” dersinde ne öğreneceğim?
Kimlik doğrulama sağlayıcılarını bağlayıp ayırarak, çakışmaları yöneterek ve bağlı kimlik bilgilerini güvenle idare ederek tek bir kullanıcının birden çok giriş yöntemiyle tek bir hesaba sahip olması… Firebase Auth & Realtime Database Apps ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Firebase Auth & Realtime Database Apps öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Firebase Auth & Realtime Database Apps, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Hesapları Bağlama ve Sağlayıcı Yönetimi” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Firebase Auth & Realtime Database Apps dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Firebase Auth & Realtime Database Apps dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Telefon Numarasıyla Kimlik Doğrulama
- Çok Faktörlü Kimlik Doğrulama (MFA)
- Özel İddialar ve Güvenlik Kuralları
- Hesapları Bağlama ve Sağlayıcı Yönetimi