File tree Expand file tree Collapse file tree 6 files changed +12
-1
lines changed
androidMain/kotlin/dev/gitlive/firebase/auth
commonMain/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 +12
-1
lines changed Original file line number Diff line number Diff line change 1
- version = " 0.1 .0"
1
+ version = " 0.2 .0"
2
2
3
3
plugins {
4
4
id(" com.android.library" )
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ actual class FirebaseAuth internal constructor(val android: com.google.firebase.
21
21
actual val currentUser: FirebaseUser ?
22
22
get() = android.currentUser?.let { FirebaseUser (it) }
23
23
24
+ actual suspend fun signInWithEmailAndPassword (email : String , password : String ) =
25
+ AuthResult (android.signInWithEmailAndPassword(email, password).await())
26
+
24
27
actual suspend fun signInWithCustomToken (token : String ) =
25
28
AuthResult (android.signInWithCustomToken(token).await())
26
29
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ expect fun Firebase.auth(app: FirebaseApp): FirebaseAuth
17
17
expect class FirebaseAuth {
18
18
val currentUser: FirebaseUser ?
19
19
val authStateChanged: Flow <FirebaseUser ?>
20
+ suspend fun signInWithEmailAndPassword (email : String , password : String ): AuthResult
20
21
suspend fun signInWithCustomToken (token : String ): AuthResult
21
22
suspend fun signInAnonymously (): AuthResult
22
23
suspend fun signOut ()
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ actual class FirebaseAuth internal constructor(val ios: FIRAuth) {
26
26
actual val currentUser: FirebaseUser ?
27
27
get() = ios.currentUser?.let { FirebaseUser (it) }
28
28
29
+ actual suspend fun signInWithEmailAndPassword (email : String , password : String ) =
30
+ AuthResult (ios.awaitResult { signInWithEmailAndPassword(email, password, it) })
31
+
29
32
actual suspend fun signInWithCustomToken (token : String ) =
30
33
AuthResult (ios.awaitResult { signInWithCustomToken(token, it) })
31
34
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ actual class FirebaseAuth internal constructor(val js: firebase.auth.Auth) {
20
20
actual val currentUser: FirebaseUser ?
21
21
get() = rethrow { js.currentUser?.let { FirebaseUser (it) } }
22
22
23
+ actual suspend fun signInWithEmailAndPassword (email : String , password : String ) =
24
+ rethrow { AuthResult (js.signInWithEmailAndPassword(email, password).await()) }
25
+
23
26
actual suspend fun signInWithCustomToken (token : String )
24
27
= rethrow { AuthResult (js.signInWithCustomToken(token).await()) }
25
28
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ external object firebase {
57
57
open class Auth {
58
58
val currentUser: user.User ?
59
59
60
+ fun signInWithEmailAndPassword (email : String , password : String ): Promise <AuthResult >
60
61
fun signInWithCustomToken (token : String ): Promise <AuthResult >
61
62
fun signInAnonymously (): Promise <AuthResult >
62
63
fun signOut (): Promise <Unit >
You can’t perform that action at this time.
0 commit comments