File tree Expand file tree Collapse file tree 6 files changed +26
-0
lines changed
androidMain/kotlin/dev/gitlive/firebase/auth
commonMain/kotlin/dev/gitlive/firebase/auth
commonTest/kotlin/dev/gitlive/firebase/auth
iosMain/kotlin/dev/gitlive/firebase/auth
jsMain/kotlin/dev/gitlive/firebase/auth
firebase-common/src/jsMain/kotlin/dev/gitlive/firebase Expand file tree Collapse file tree 6 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ actual object EmailAuthProvider {
2828 email : String ,
2929 password : String
3030 ): AuthCredential = AuthCredential (com.google.firebase.auth.EmailAuthProvider .getCredential(email, password))
31+
32+ actual fun credentialWithLink (
33+ email : String ,
34+ emailLink : String
35+ ): AuthCredential = AuthCredential (com.google.firebase.auth.EmailAuthProvider .getCredentialWithLink(email, emailLink))
3136}
3237
3338actual object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ expect class OAuthCredential : AuthCredential
1515
1616expect object EmailAuthProvider {
1717 fun credential (email : String , password : String ): AuthCredential
18+ fun credentialWithLink (email : String , emailLink : String ): AuthCredential
1819}
1920
2021expect object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -105,6 +105,14 @@ class FirebaseAuthTest {
105105 assertFalse(Firebase .auth.isSignInWithEmailLink(invalidLink))
106106 }
107107
108+ @Test
109+ fun testCredentialWithLink () {
110+ val link = " http://localhost:9099/emulator/action?mode=signIn&lang=en&oobCode=_vr0QcFcxcVeLZbrcU-GpTaZiuxlHquqdC8MSy0YM_vzWCTAQgV9Jq&apiKey=fake-api-key&continueUrl=https%3A%2F%2Fexample.com%2Fsignin"
111+ val email = " test@test.com"
112+ val credential = EmailAuthProvider .credentialWithLink(email, link)
113+ assertEquals(" password" , credential.providerId)
114+ }
115+
108116 private suspend fun getTestUid (email : String , password : String ): String {
109117 val uid = Firebase .auth.let {
110118 val user = try {
Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ actual object EmailAuthProvider {
2020 password : String
2121 ): AuthCredential =
2222 AuthCredential (FIREmailAuthProvider .credentialWithEmail(email = email, password = password))
23+
24+ actual fun credentialWithLink (
25+ email : String ,
26+ emailLink : String
27+ ): AuthCredential =
28+ AuthCredential (FIREmailAuthProvider .credentialWithEmail(email = email, link = emailLink))
2329}
2430
2531actual object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ actual class OAuthCredential(js: firebase.auth.AuthCredential) : AuthCredential(
1616actual object EmailAuthProvider {
1717 actual fun credential (email : String , password : String ): AuthCredential =
1818 AuthCredential (firebase.auth.EmailAuthProvider .credential(email, password))
19+
20+ actual fun credentialWithLink (
21+ email : String ,
22+ emailLink : String
23+ ): AuthCredential = AuthCredential (firebase.auth.EmailAuthProvider .credentialWithLink(email, emailLink))
1924}
2025
2126actual object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ external object firebase {
128128 class EmailAuthProvider : AuthProvider {
129129 companion object {
130130 fun credential (email : String , password : String ): AuthCredential
131+ fun credentialWithLink (email : String , emailLink : String ): AuthCredential
131132 }
132133 }
133134
You can’t perform that action at this time.
0 commit comments