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 {
28
28
email : String ,
29
29
password : String
30
30
): 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))
31
36
}
32
37
33
38
actual object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ expect class OAuthCredential : AuthCredential
15
15
16
16
expect object EmailAuthProvider {
17
17
fun credential (email : String , password : String ): AuthCredential
18
+ fun credentialWithLink (email : String , emailLink : String ): AuthCredential
18
19
}
19
20
20
21
expect object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -105,6 +105,14 @@ class FirebaseAuthTest {
105
105
assertFalse(Firebase .auth.isSignInWithEmailLink(invalidLink))
106
106
}
107
107
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
+
112
+ val credential = EmailAuthProvider .credentialWithLink(email, link)
113
+ assertEquals(" password" , credential.providerId)
114
+ }
115
+
108
116
private suspend fun getTestUid (email : String , password : String ): String {
109
117
val uid = Firebase .auth.let {
110
118
val user = try {
Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ actual object EmailAuthProvider {
20
20
password : String
21
21
): AuthCredential =
22
22
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))
23
29
}
24
30
25
31
actual object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ actual class OAuthCredential(js: firebase.auth.AuthCredential) : AuthCredential(
16
16
actual object EmailAuthProvider {
17
17
actual fun credential (email : String , password : String ): AuthCredential =
18
18
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))
19
24
}
20
25
21
26
actual object FacebookAuthProvider {
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ external object firebase {
128
128
class EmailAuthProvider : AuthProvider {
129
129
companion object {
130
130
fun credential (email : String , password : String ): AuthCredential
131
+ fun credentialWithLink (email : String , emailLink : String ): AuthCredential
131
132
}
132
133
}
133
134
You can’t perform that action at this time.
0 commit comments